【rac】實驗一:啟動關閉歸檔

不一樣的天空w發表於2016-11-09

1. 啟動歸檔
1.1. 確認歸檔狀態

[oracle@node2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 09:55:42 2016

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SYS@PROD1>archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     68

Current log sequence           69

 

1.2. 關閉資料庫

[oracle@node2 ~]$ srvctl stop database -d prod -o immediate;

[oracle@node2 ~]$

[oracle@node2 ~]$ su - grid

Password:

[grid@node2 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.FRA.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                       

ora.LISTENER.lsnr

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                        

ora.OCR.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.asm

               ONLINE  ONLINE       node1                    Started             

               ONLINE  ONLINE       node2                    Started            

ora.eons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                        

ora.gsd

               OFFLINE OFFLINE      node1                                       

               OFFLINE OFFLINE      node2                                       

ora.net1.network

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.ons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.registry.acfs

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                        

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       node2                                        

ora.node1.vip

      1        ONLINE  ONLINE       node1                                       

ora.node2.vip

      1        ONLINE  ONLINE       node2                                       

ora.oc4j

      1        OFFLINE OFFLINE                                                  

ora.prod.db

      1        OFFLINE OFFLINE                               Instance Shutdown  

      2        OFFLINE OFFLINE                               Instance Shutdown  

ora.prod2.db

      1        OFFLINE OFFLINE                                                  

      2        OFFLINE OFFLINE                                                  

ora.scan1.vip

      1        ONLINE  ONLINE       node2                                       

[grid@node2 ~]$

 

1.3. 將其中一個節點啟動到 mount

[oracle@node2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 09:59:25 2016

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@PROD1>startup mount;

ORACLE instance started.

 

Total System Global Area  849530880 bytes

Fixed Size                  1339824 bytes

Variable Size             562040400 bytes

Database Buffers          281018368 bytes

Redo Buffers                5132288 bytes

Database mounted.

 

1.4. 啟動歸檔

SYS@PROD1>archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     68

Current log sequence           69

SYS@PROD1>

SYS@PROD1>alter database archivelog;

 

Database altered.

 

SYS@PROD1>archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     68

Next log sequence to archive   69

Current log sequence           69

 

1.5. 開啟資料庫
兩個節點分別開啟
一節點:

SYS@PROD1>alter database open;

 

Database altered.

 

SYS@PROD1>

 

二節點:

[oracle@node1 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 10:02:19 2016

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@PROD2>startup

ORACLE instance started.

 

Total System Global Area  849530880 bytes

Fixed Size                  1339824 bytes

Variable Size             595594832 bytes

Database Buffers          247463936 bytes

Redo Buffers                5132288 bytes

Database mounted.

Database opened.

SYS@PROD2>

SYS@PROD2>archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     7

Next log sequence to archive   8

Current log sequence           8

SYS@PROD2>

 

2. 關閉歸檔

2.1. 確認歸檔狀態

SYS@PROD1>archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     69

Next log sequence to archive   70

Current log sequence           70

 

2.2. 關閉資料庫

前面已經關閉了資料庫,檢視叢集狀態:(注意手動開啟的庫,還得手動關閉,因為rac叢集不認手動關啟庫的命令)

[grid@node2 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.FRA.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.LISTENER.lsnr

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.OCR.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                       

ora.asm

               ONLINE  ONLINE       node1                    Started            

               ONLINE  ONLINE       node2                    Started             

ora.eons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.gsd

               OFFLINE OFFLINE      node1                                        

               OFFLINE OFFLINE      node2                                       

ora.net1.network

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.ons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.registry.acfs

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       node2                                       

ora.node1.vip

      1        ONLINE  ONLINE       node1                                       

ora.node2.vip

      1        ONLINE  ONLINE       node2                                       

ora.oc4j

      1        OFFLINE OFFLINE                                                  

ora.prod.db

      1        OFFLINE OFFLINE                               Instance Shutdown  

      2        OFFLINE OFFLINE                               Instance Shutdown  

ora.prod2.db

      1        OFFLINE OFFLINE                                                  

      2        OFFLINE OFFLINE                                                  

ora.scan1.vip

      1        ONLINE  ONLINE       node2     

 

2.3. 將其中一個節點啟動到 mount

[oracle@node2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 10:20:16 2016

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@PROD1>startup mount;

ORACLE instance started.

 

Total System Global Area  849530880 bytes

Fixed Size                  1339824 bytes

Variable Size             562040400 bytes

Database Buffers          281018368 bytes

Redo Buffers                5132288 bytes

Database mounted.

 

2.4. 關閉歸檔

SYS@PROD1>archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     69

Next log sequence to archive   70

Current log sequence           70

SYS@PROD1>

SYS@PROD1>alter database noarchivelog;

 

Database altered.

 

SYS@PROD1>archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     69

Current log sequence           70

SYS@PROD1>

 

2.5. 開啟資料庫
兩個節點分別開啟
一節點:

SYS@PROD1>alter database open;

 

Database altered.

 

二節點:

[oracle@node1 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 10:23:36 2016

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@PROD2>startup

ORACLE instance started.

 

Total System Global Area  849530880 bytes

Fixed Size                  1339824 bytes

Variable Size             595594832 bytes

Database Buffers          247463936 bytes

Redo Buffers                5132288 bytes

Database mounted.

Database opened.

SYS@PROD2>

SYS@PROD2>archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     8

Current log sequence           9

SYS@PROD2>

 

注意:手動開啟的庫,還得手動關閉,因為rac叢集不認手動關啟庫的命令。

節點一:

SYS@PROD1>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@PROD1>

 

節點二:

SYS@PROD2>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

——叢集命令啟動資料庫:

[grid@node2 ~]$ srvctl start database -d prod


                          

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2128191/,如需轉載,請註明出處,否則將追究法律責任。

相關文章