關閉
1.先關數據庫:
復制代碼 代碼如下:
[oracle@oeltan1 ~]$ srvctl stop database -d tantest
2.再關閉crs服務
[復制代碼 代碼如下:
root@oeltan1 ~]# crsctl stop crs
啟動:
復制代碼 代碼如下:
[root@oeltan1 ~]# crsctl start crs
[oracle@oeltan1 ~]$srvctl start asm -n node_name
上述開機一般已經啟動
復制代碼 代碼如下:
[oracle@oeltan1 ~]$ srvctl start database -d tantest
歸檔設置:
1. 分別創建兩個實例的ASM目錄
任意一個實例,grid用戶下:
復制代碼 代碼如下:
# su - grid
[grid@oeltan1 ~]$ sqlplus "/as sysasm"
SQL> select name from V$asm_diskgroup;
NAME
--------------------------------------------------------------------------------
CRS
DATA1
FRI
SQL> alter diskgroup FRI add directory '+FRI/TANTEST'; SQL> alter diskgroup FRI add directory '+FRI/TANTEST/ARCH1';
還可以通過asmcmd創建目錄:
ASMCMD> pwd +FRI/TANTEST ASMCMD> mkdir ARCH2
2.修改歸檔參數
任意一個實例,oracle用戶下:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+FRI/TANTEST/ARCH1' SCOPE=both SID='tantest1'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+FRI/TANTEST/ARCH2' SCOPE=both SID='tantest2';
3.兩個節點上分別都執行:
SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT; SQL> ALTER DATABASE ARCHIVELOG; SQL> ALTER DATABASE OPEN;
--修改一個實例時,另一個實例不能在open狀態,否則報ORA-01126: database must be mounted in this instance and not open in any
4.分別檢查:
SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination +FRI/tantest/arch1 Oldest online log sequence 14 Next log sequence to archive 15 Current log sequence 15 SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination +FRI/tantest/arch2 Oldest online log sequence 6 Next log sequence to archive 7 Current log sequence 7 SQL>
如果開啟歸檔,請保證log_archive_start=true開啟自動歸檔,否則只能手工歸檔,如果是關閉了歸檔,則設置該參數為false 注意:如果是OPS/RAC環境,需要先把parallel_server = true注釋掉,然後執行如下步驟,最後用這個參數重新啟動 1、開啟歸檔 a. 關閉數據庫shutdown immediate b. startup mount c. alter database archivelog d. alter database opne 2、禁止歸檔 a. 關閉數據庫shutdown immediate b. startup mount c. alter database noarchivelog d. alter database open 歸檔信息可以通過如下語句查看 SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination E:\oracle\ora92\database\archive Oldest online log sequence 131 Next log sequence to archive 133 Current log sequence 133
SQL> conn / as sysdba
SQL> shutdown immediate;
SQL> startup mount
SQL> alter database archivelog;
SQL> alter system set control_file_record_keep_time=30 scope=spfile;
SQL> alter system set log_archive_dest_1='location=E:\Oracle\oradata\MYDB_ARCH' scope=spfile;
SQL> alter database open;
SQL> archive log list;
SQL> alter system archive log start;
SQL> shutdown immediate
SQL> startup
SQL> alter database force logging;