SQL> startup pfile='/home/oracle/pfiledgtest1.ora';
ORACLE instance started.
Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 939525000 bytes
Database Buffers 3321888768 bytes
Redo Buffers 12107776 bytes
Database mounted.
Database opened.
SQL>
7. 確定修改完pfile,數(shù)據(jù)庫還能正常起來后將數(shù)據(jù)庫給down下來。(這里用來給數(shù)據(jù)庫做冷備)測試環(huán)境,所以能直接起停。
8. 創(chuàng)建standby數(shù)據(jù)庫,在oradata目錄下新建dgtest2目錄。
[oracle@oradata]$ pwd
/ulic/oradata
[oracle@bdev oradata]$ ls -l
total 8
drwxr-x--- 2 oracle oinstall 4096 Oct 18 17:07 dgtest1
drwxr-xr-x 2 oracle oinstall 4096 Oct 19 11:10 dgtest2
9. 將dgtest1目錄下的datafile和log復制到dgtest2目錄下。
[oracle@bdev dgtest2]$ ls -l
total 1561220
-rw-r----- 1 oracle oinstall 52429312 Oct 19 13:53 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Oct 19 13:53 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Oct 19 13:53 redo03.log
-rw-r----- 1 oracle oinstall 555753472 Oct 19 14:19 sysaux01.dbf
-rw-r----- 1 oracle oinstall 775954432 Oct 19 14:19 system01.dbf
-rw-r----- 1 oracle oinstall 30416896 Oct 19 11:05 temp01.dbf
-rw-r----- 1 oracle oinstall 73408512 Oct 19 14:19 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Oct 19 14:19 users01.dbf
10. 主庫開庫生成standby 控制文件,并copy到dgtest2目錄下,并復制兩份到control01.ctl, control02.ctl。
alter database create standby controlfile as '/ulic/oradata/dgtest2/control.std';
[oracle@dgtest2]$ ls -l
total 1561220
-rw-r----- 1 oracle oinstall 9748480 Oct 19 15:48 control01.ctl
-rw-r----- 1 oracle oinstall 9748480 Oct 19 15:48 control02.ctl
-rw-r----- 1 oracle asmadmin 9748480 Oct 19 11:08 control.std
-rw-r----- 1 oracle oinstall 52429312 Oct 19 13:53 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Oct 19 13:53 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Oct 19 13:53 redo03.log
-rw-r----- 1 oracle oinstall 555753472 Oct 19 14:19 sysaux01.dbf
-rw-r----- 1 oracle oinstall 775954432 Oct 19 14:19 system01.dbf
-rw-r----- 1 oracle oinstall 30416896 Oct 19 11:05 temp01.dbf
-rw-r----- 1 oracle oinstall 73408512 Oct 19 14:19 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Oct 19 14:19 users01.dbf
11. 復制一份pfiledgtest1.ora到pfiledgtest2.ora,并修改內(nèi)容。
[oracle@~]$ more pfiledgtest2.ora
dgtest2.__db_cache_size=3338665984
dgtest2.__java_pool_size=67108864
dgtest2.__large_pool_size=83886080
dgtest2.__oracle_base='/ulic/app/oracle'#ORACLE_BASE set from environment
dgtest2.__pga_aggregate_target=2147483648
dgtest2.__sga_target=4294967296
dgtest2.__shared_io_pool_size=0
dgtest2.__shared_pool_size=771751936
dgtest2.__streams_pool_size=0
*.audit_file_dest='/ulic/app/oracle/admin/dgtest2/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/ulic/oradata/dgtest2/control01.ctl','/ulic/oradata/dgtest2/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_recovery_file_dest='/ulic/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/ulic/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dgtest2XDB)'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=2147483648
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=4294967296
*.undo_tablespace='UNDOTBS1'
DB_NAME=dgtest1
DB_UNIQUE_NAME=dgtest2
LOG_ARCHIVE_CONFIG='DG_CONFIG=(dgtest1,dgtest2)'
LOG_ARCHIVE_DEST_1=
'LOCATION=/ulic/archivelog/dgtest2/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=dgtest2'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
FAL_SERVER=dgtest1
FAL_CLIENT=dgtest2
DB_FILE_NAME_CONVERT='/ulic/oradata/dgtest1','/ulic/oradata/dgtest2'
LOG_FILE_NAME_CONVERT='/ulic/oradata/dgtest1','/ulic/oradata/dgtest2'
STANDBY_FILE_MANAGEMENT=AUTO
12. 配置監(jiān)聽。
DGTEST1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bdev)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dgtest1)
)
)
DGTEST2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.18.1.123)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dgtest2)
)
)
13.啟動備庫到mount狀態(tài)。
SQL> startup mount pfile='/home/oracle/pfiledgtest2.ora';
ORACLE instance started.
Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 939525000 bytes
Database Buffers 3321888768 bytes
Redo Buffers 12107776 bytes
Database mounted.
查看備庫身份
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
查看主庫身份
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
14. 從庫進行standby recover 開始應用日志。
alter database recover managed standby database disconnect from session;
15.切換日志驗證是否能正常傳輸。