Rac架構數據庫的歸檔模式啓動方法與單機的不同。我們來看下步驟
當前系統狀態
歸檔 – No
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/oracle/product/11.2.0/db/dbs/arch
Oldest online log sequence 43
Current log sequence 46
查看db名
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string neicedb
db_unique_name string neicedb
global_names boolean FALSE
instance_name string neicedb1
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string neicedb
配置歸檔
調整參數
在一個節點上修改即可:
SQL> alter system set db_recovery_file_dest_size=500g;
System altered.
SQL> alter system set db_recovery_file_dest='+ARCH';
System altered.
SQL> alter system set log_archive_dest_1='location=use_db_recovery_file_dest' scope=spfile sid='*';
System altered.
修改爲非集羣數據庫
,該參數爲靜態參數,需要使用scope=spfile
SQL> alter system set cluster_database=false scope=spfile;
System altered.
關閉rac所有實例
我這裏用的是很簡單的方法,需要分別去各個節點執行shutdown。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
啓動歸檔模式
這裏只需要在一個節點上執行,開啓歸檔的命令。
SQL> startup mount
ORACLE instance started.
Total System Global Area 1.4999E+10 bytes
Fixed Size 2267832 bytes
Variable Size 2583692616 bytes
Database Buffers 1.2382E+10 bytes
Redo Buffers 31125504 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
現在數據庫是歸檔模式了,但不是集羣,我們把參數在調整回來。
調整參數 --> 關庫 --> 起庫
SQL> alter system set cluster_database=true scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
既然又回到cluster的模式了,我們可以把所有的節點都啓動
起來了:
SQL> startup
ORACLE instance started.
Total System Global Area 1.4999E+10 bytes
Fixed Size 2267832 bytes
Variable Size 2583692616 bytes
Database Buffers 1.2382E+10 bytes
Redo Buffers 31125504 bytes
Database mounted.
Database opened.
驗證歸檔
- 查看數據庫配置
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 43
Next log sequence to archive 46
Current log sequence 46
- 切換日誌,查看是否已經在指定路徑下生成了歸檔文件。
SQL> alter system switch logfile;
System altered.
SQL> exit
[oracle@oracle11g1 ~]$ exit
logout
[root@oracle11g1 rules.d]# su - grid
Last login: Mon Jun 15 09:56:50 CST 2020 on pts/1
[grid@oracle11g1 ~]$ asmcmd
ASMCMD> cd arch
ASMCMD> ls
NEICEDB/
ASMCMD> cd neicedb
ASMCMD> ls
ARCHIVELOG/
ASMCMD> cd arch*
ASMCMD> ls
2020_06_15/
ASMCMD> cd 2020*
ASMCMD> ls
thread_1_seq_46.257.1043164887
thread_2_seq_22.256.1043164843
確認無誤