当前位置:数据库 > Oracle >>

测试11G Oracle Restart能否自动启动被杀掉的组件

测试11G Oracle Restart能否自动启动被杀掉的组件
 
故事主人公:oralce 11g 之 restart
Oracle Restartis another component of Oracle Grid Infrastructure for a Standalone Server that will be used in this guide.
Starting with Oracle Database 11g Release 2, thedbstart anddbshut scripts that were used to automate database startup and shutdown in previous Oracle versions are deprecated. Oracle now recommends to configure Oracle Database with the OracleRestart feature to automatically restart the database, the listener, Oracle Automatic Storage Management (Oracle ASM), and other Oracle components after a hardware or software failure or when the database host computer restarts.
 
查看环境:
[html] 
[oracle@oracle11g ~]$ . oraenv  
ORACLE_SID = [orcl] ? orcl  
The Oracle base remains unchanged with value /u01/app/oracle  
[oracle@oracle11g ~]$ srvctl config database -d orcl  
Database unique name: orcl  
Database name: orcl  
Oracle home: /u01/app/oracle/acfsmounts/acfs_db1/dbhome_1  
Oracle user: oracle  
Spfile: +DATA/orcl/spfileorcl.ora  
Domain:   
Start options: open  
Stop options: immediate  
Database role: PRIMARY  
Management policy: AUTOMATIC  
Database instance: orcl  
Disk Groups: DATA,FRA  
Services:   
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle    5836     1  0 10:08 ?        00:00:00 ora_lgwr_orcl  
oracle    9087  8813  0 10:26 pts/1    00:00:00 grep ora_lgwr_orcl  
oracle@oracle11g ~]$ kill -9 5836  
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle    9116  8813  0 10:26 pts/1    00:00:00 grep ora_lgwr_orcl  
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle    9281     1  0 10:27 ?        00:00:00 ora_lgwr_orcl  
oracle    9337  8813  0 10:27 pts/1    00:00:00 grep ora_lgwr_orcl  

 

 
=从Oracle Restart配置里移除orcl数据库实例=
[html] 
[oracle@oracle11g ~]$ srvctl status database -d orcl  
Database is running.  
[oracle@oracle11g ~]$ srvctl config database -d orcl  
Database unique name: orcl  
Database name: orcl  
Oracle home: /u01/app/oracle/acfsmounts/acfs_db1/dbhome_1  
Oracle user: oracle  
Spfile: +DATA/orcl/spfileorcl.ora  
Domain:   
Start options: open  
Stop options: immediate  
Database role: PRIMARY  
Management policy: AUTOMATIC  
Database instance: orcl  
Disk Groups: DATA,FRA  
Services:   
[oracle@oracle11g ~]$ srvctl remove database -d orcl  
PRKO-3141 : Database orcl could not be removed because it was running  
[oracle@oracle11g ~]$ srvctl stop database -d orcl  
[oracle@oracle11g ~]$ srvctl status database -d orcl  
Database is not running.  
[oracle@oracle11g ~]$ srvctl remove database -d orcl  
Remove the database orcl? (y/[n]) y  
[oracle@oracle11g ~]$ srvctl remove database -d orcl  
PRCD-1120 : The resource for database orcl could not be found.  
PRCR-1001 : Resource ora.orcl.db does not exist  

 

 
 
 
=重启orcl数据库实例=
[html] 
[oracle@oracle11g ~]$ srvctl start database -d orcl  
PRCD-1120 : The resource for database orcl could not be found.  
PRCR-1001 : Resource ora.orcl.db does not exist  
[oracle@oracle11g ~]$ sqlplus / as sysdba  
  
  
SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 19 10:42:00 2012  
Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
Connected to an idle instance.  
  
SQL> startup  
ORACLE instance started.  
Total System Global Area  521936896 bytes  
Fixed Size                  2229944 bytes  
Variable Size             352323912 bytes  
Database Buffers          163577856 bytes  
Redo Buffers                3805184 bytes  
Database mounted.  
Database opened.  
SQL> exit  
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production  
With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options  

 

 
 
=再次测试Oracle Restart能否自动启动被杀掉的组件=
[html] 
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle   11287     1  0 10:42 ?        00:00:00 ora_lgwr_orcl  
oracle   11696  8813  0 10:44 pts/1    00:00:00 grep ora_lgwr_orcl  
[oracle@oracle11g ~]$ kill -9 11287  
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle   11700  8813  0 10:45 pts/1    00:00:00 grep ora_lgwr_orcl  

 

 
 
=发现不会再次重启,手工重启数据库=
[html] 
oracle@oracle11g ~]$ sqlplus / as sysdba  
  
SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 19 10:46:04 2012Copyright (c) 1982, 2011, Oracle. All rights reserved.  
  
Connected to an idle instance.  
SQL> startup  
[html] 
ORACLE instance started.  
Total System Global Area 521936896 bytes  
Fixed Size 2229944 bytes  
Variable Size 352323912 bytes  
Database Buffers 163577856 bytes  
Redo Buffers 3805184 bytes  
Database mounted.  
Database opened.  
SQL> exit  
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit   
ProductionWith the Partitioning, Automatic Storage Management, OLAP, Data Miningand Real Application Testing options  

 

 
=使用EM将orcl数据库实例加回到Oracle Restart配置里,如果发现页面上仍旧是Enabled则只能手工添加=
[html] 
[oracle@oracle11g ~]$ srvctl add database -d orcl -o /u01/app/oracle/acfsmounts/acfs_db1/dbhome_1  
[oracle@oracle11g ~]$ srvctl config database -d orcl  
Database unique name: orcl  
Database name:   
Oracle home: /u01/app/oracle/acfsmounts/acfs_db1/dbhome_1  
Oracle user: oracle  
Spfile:   
Domain:   
Start options: open  
Stop options: immediate  
Database role: PRIMARY  
Management policy: AUTOMATIC  
Database instance: orcl  
Disk Groups:   
Services:   
[oracle@oracle11g ~]$ srvctl status database -d orcl  
Database is not running.  
[oracle@oracle11g ~]$ srvctl start database -d orcl  
[oracle@oracle11g ~]$ srvctl status database -d orcl  
Database is running.  
[oracle@oracle11g ~]$ srvctl config database -d orcl  
Database unique name: orcl  
Database name:   
Oracle home: /u01/app/oracle/acfsmounts/acfs_db1/dbhome_1  
Oracle user: oracle  
Spfile:   
Domain:   
Start options: open  
Stop options: immediate  
Database role: PRIMARY  
Management policy: AUTOMATIC  
Database instance: orcl  
Disk Groups:   
Services:   
[oracle@oracle11g ~]$ srvctl modify database -d orcl -n orcl -p +DATA/orcl/spfileorcl.ora -a DATA,FRA  
[oracle@oracle11g ~]$ srvctl config database -d orcl  
Database unique name: orcl  
Database name: orcl  
Oracle home: /u01/app/oracle/acfsmounts/acfs_db1/dbhome_1  
Oracle user: oracle  
Spfile: +DATA/orcl/spfileorcl.ora  
Domain:   
Start options: open  
Stop options: immediate  
Database role: PRIMARY  
Management policy: AUTOMATIC  
Database instance: orcl  
Disk Groups: DATA,FRA  
Services:   

 

 
=确认orcl数据库实例是否添加到Oracle Restart成功=
[html] 
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle   17276     1  0 11:05 ?        00:00:00 ora_lgwr_orcl  
oracle   25574  8813  0 11:14 pts/1    00:00:00 grep ora_lgwr_orcl  
[oracle@oracle11g ~]$ kill -9 17276  
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle   26107  8813  0 11:14 pts/1    00:00:00 grep ora_lgwr_orcl  
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl  
oracle   26952     1  0 11:15 ?        00:00:00 ora_lgwr_orcl  
oracle   27282  8813  0 11:15 pts/1    00:00:00 grep ora_lgwr_orcl  

 

 
=关闭orcl数据库实例上的Oracle Restart=
[html] 
[oracle@oracle11g ~]$ srvctl status database -d orcl -f  
Database is disabled  
Database is running.  

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,