Propose: Build physical Standby database on oracle816
Author: Alexander zeng
Date: 2005.08.22
--step1. install oracle
--step2. build db
cp datafiles from a cold backup db
C:\>oradim -NEW -SID poi -INTPWD "oracle" -PFILE "D:\Oracle\Ora81\DATABASE\initpoi.ora"
C:\>oradim -NEW -SID pna -INTPWD "oracle" -PFILE "D:\Oracle\Ora81\DATABASE\initpna.ora"
C:\>orapwd file="D:\Oracle\Ora81\DATABASE\PWDpoi.ORA" password=oracle entries=5
C:\>orapwd file="D:\Oracle\Ora81\DATABASE\PWDpna.ORA" password=oracle entries=5
modify sqlnet.ora
######################################
#NAMES.DEFAULT_DOMAIN = televigation.cn
#SQLNET.AUTHENTICATION_SERVICES= (NTS)
SQLNET.AUTHENTICATION_SERVICES= (NONE)
######################################
modify listener.ora
######################################
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.34)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\Oracle\Ora81)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = poi)
(ORACLE_HOME = D:\oracle\ora81)
(SID_NAME = poi)
)
(SID_DESC =
(GLOBAL_DBNAME = pna)
(ORACLE_HOME = D:\oracle\ora81)
(SID_NAME = pna)
)
)
######################################
restart lsnrctl and service
--step3. setup primary db
modify D:\Oracle\Ora81\DATABASE\initpoi.ora
######################################
log_archive_start = true
log_archive_dest_1 = "location=D:\oracle\oradata\poi\archive mandatory"
log_archive_format = poi_%t_%s.ARC
######################################
C:\>set oracle_sid=poi
C:\>sqlplus /nolog
SQL> conn sys/oracle as sysdba
已连接。
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> archive log list
SQL> alter database create standby controlfile as 'D:\Oracle\standby_poi.ctl';
SQL> shutdown immediate
--step4.cp files from primary to standby
standby db:
mkdir D:\Oracle\oradata
mkdir E:\Oracle\oradata
mkdir E:\Oracle\oradata\poi
mkdir D:\oracle\oradata\poi\standby_archlog
from primary db to standby db
cp D:\Oracle\Ora81\DATABASE\initpoi.ora D:\Oracle\Ora81\DATABASE\initpoi.ora
cp D:\Oracle\standby_poi.ctl D:\oracle\oradata\poi\STANDBY_POI.CTL
cp D:\Oracle\standby_poi.ctl E:\oracle\oradata\poi\STANDBY_POI.CTL
cp D:\Oracle\oradata\poi D:\Oracle\oradata\poi
cp D:\Oracle\Ora81\network\ADMIN\listener.ora D:\Oracle\Ora81\network\ADMIN\listener.ora
cp D:\Oracle\Ora81\network\ADMIN\sqlnet.ora D:\Oracle\Ora81\network\ADMIN\sqlnet.ora
cp D:\Oracle\Ora81\network\ADMIN\tnsnames.ora D:\Oracle\Ora81\network\ADMIN\tnsnames.ora
cp e:\oracle e:\oracle
primary db:
modify initpoi.ora
######################################
log_archive_dest_2='service=STANDBY_POI'
log_archive_dest_state_2=enable
standby_archive_dest='D:\oracle\oradata\poi\standby_archlog'
######################################
standby db:
modify initpoi.ora
######################################
control_files = ("D:\oracle\oradata\poi\STANDBY_POI.CTL", "E:\oracle\oradata\poi\STANDBY_POI.CTL")
standby_archive_dest='D:\oracle\oradata\poi\standby_archlog'
#standby_file_management=AUTO --oracle816 don't support
#remote_archive_enable=TRUE --oracle816 don't support
######################################
modify network/admin/listener.ora
###############################
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.40)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\Oracle\Ora81)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = poi)
(ORACLE_HOME = D:\oracle\ora81)
(SID_NAME = poi)
)
(SID_DESC =
(GLOBAL_DBNAME = pna)
(ORACLE_HOME = D:\oracle\ora81)
(SID_NAME = pna)
)
)
###############################
modify network/admin/sqlnet.ora
###############################
#NAMES.DEFAULT_DOMAIN = televigation.cn
SQLNET.EXPIRE_TIME=2
###############################
modify network/admin/tnsnames.ora
###############################
POI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.34)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = poi)
)
)
STANDBY_POI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.40)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = poi)
)
)
###############################
create passwd file
C:\>orapwd file="D:\Oracle\Ora81\DATABASE\PWDpoi.ORA" password=oracle entries=5
C:\>oradim -NEW -SID poi -INTPWD "oracle" -STARTMODE m -PFILE "D:\Oracle\Ora81\DATABASE\initpoi.ora"
--step5. startup standby db
SQL> conn sys/oracle as sysdba
SQL> startup nomount;
SQL> alter database mount standby database;
SQL> alter database recover managed standby database;
--oracle816 don't support
--SQL> alter database recover managed standby database disconnect from session;
SQL> select SEQUENCE# ,APPLIED from v$archived_log;
test tnsping on both machines
tnsping standby_poi
tnsping poi
--step6.verify the physical standby db
--startup primary
SQL> startup
--standby db
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
未选定行
--primary db
SQL> alter system archive log current;
--standby db
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
--problems: resolve gap
alter database recover automatic standby database;
cancel;
--check standby
primary db
SQL> update dual set dummy='G';
SQL> alter system archive log current;
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
3567
--standby db
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
3567
SQL> shutdown immediate
SQL> startup nomount
SQL> alter database mount standby database;
数据库已更改。
SQL> alter database open read only;
数据库已更改。
SQL> select * from dual;
D
-
G
阅读(1037) | 评论(0) | 转发(0) |