oralce 11g new feature 之 oracle restart

Oracle Restart

It is another component of Oracle Grid Infrastructure for a Standalone Server that will be used in this guide.Starting with Oracle Database 11<em>g</em> Release 2, the<tt>dbstart</tt> and<tt>dbshut</tt> scripts that were used to automate   database startup and shutdown in previous Oracle versions aredeprecated. Oracle now recommends to configure Oracle Database with the 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.


举例:

查看环境

[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数据库实例

[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数据库实例

[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能否自动启动被杀掉的组件

[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  


发现不会再次重启,手工重启数据库

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                                                                                                             
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则只能手工添加

[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成功

[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

[oracle@oracle11g ~]$ srvctl status database -d orcl -f  
Database is disabled                                     
Database is running.                                    


验证关闭Oracle Restart之后,是否会自动启动被杀掉的组件

[oracle@oracle11g ~]$ kill -9 26952                                  
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl                     
oracle   29080  8813  0 11:19 pts/1    00:00:00 grep ora_lgwr_orcl   
[oracle@oracle11g ~]$ ps -ef |grep ora_lgwr_orcl                     
oracle   29461  8813  0 11:21 pts/1    00:00:00 grep ora_lgwr_orcl  


重新启动orcl数据库实例的Oracle Restart

[oracle@oracle11g ~]$ srvctl status database -d orcl -f   
Database is not running.                                  
[oracle@oracle11g ~]$ srvctl status database -d orcl -f   
Database is running.                                     


结论:Restart 特性貌似并没Oracle 吹嘘的那么神,当然ORACLE 也说明了(只适用于11.2 or later):  
Oracle Restart can only manage 11.2 resources. Oracle Database releases prior to 11.2, however, can coexist on the same server but without being managed by Oracle Restart.                     


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值