1. Make the necessary changes to the primary database.
a. Enable force logging.
b. Creating the password file if one does not exist.
c. Create standby redologs.
d. Modify the parameter file suitable for Dataguard.
2. Ensure that the sql*net connectivity is working fine.
3. Create the standby database over the network using the active(primary) database files.
a. Create the password file
b. Create the initialization parameter file for the standby database (auxiliary database)
c. Create the necessary mount points or the folders for the database files
d. Run the standby creation ON STANDBY by connecting to primary as target database.
4. Check the log shipping and apply.
While creating the standby database we use the active database files i.e., this command will be useful in creating the physical standby database using active database files over the network.
a. Ensure that the database is in archivelog mode .
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 40
Next log sequence to archive 42
Current log sequence 42
b. Enable force logging
SQL> select force_logging from v$database;
FOR
---
NO
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
SQL> alter database flashback off;
Database altered.
c. Create standby redologs
SQL> set linesize 200
SQL> col member for a60
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- ------------------------------------------------------------
3 /u01/app/oracle/oradata/PROD1/redo03.log
2 /u01/app/oracle/oradata/PROD1/redo02.log
1 /u01/app/oracle/oradata/PROD1/redo01.log
SQL>
SQL> select bytes/1024/1024 "Size MB" from v$log;
Size MB
----------
100
100
100
SQL> alter database add standby logfile '/u01/app/oracle/oradata/PROD1/redo04.log' size 100m;
Database altered.
SQL> alter database add standby logfile '/u01/app/oracle/oradata/PROD1/redo05.log' size 100m;
Database altered.
SQL> alter database add standby logfile '/u01/app/oracle/oradata/PROD1/redo06.log' size 100m;
Database altered.
SQL> select group#,member,type from v$logfile where type='STANDBY';
GROUP# MEMBER TYPE
---------- ------------------------------------------------------------ -------
4 /u01/app/oracle/oradata/PROD1/redo04.log STANDBY
5 /u01/app/oracle/oradata/PROD1/redo05.log STANDBY
6 /u01/app/oracle/oradata/PROD1/redo06.log STANDBY
d. Modify the primary initialization parameter for dataguard on primary,
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod1,sbdb1)';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/prod1/redo/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prod1';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=sbdb1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sbdb1';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
System altered.
SQL> alter system set FAL_SERVER=sbdb1;
System altered.
SQL> alter system set FAL_CLIENT=prod1;
System altered.
SQL> alter system set DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/sbdb1/','/u01/app/oracle/oradata/PROD1/' scope=spfile;
System altered.
SQL> alter system set LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/PROD1/redo/','/u01/app/oracle/oradata/PROD1/redo' scope=spfile;
System altered.
Insert a static entry for Boston in the listener.ora file of the standby system.
NOTE : For non default port set the REMOTE_LISTENER
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=135.149.96.153)(PORT=1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD1.us.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0)
(SID_NAME=PROD1))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0)
(PROGRAM=extproc)))
TNSNAMES.ORA for the Primary and Standby should have BOTH entries
PROD1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = tcp)(HOST = 135.149.96.153)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD1)
)
)
SBDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = tcp)(HOST = 135.149.96.152)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SBDB1.us.oracle.com)
)
)
Check with the SQL*Net configuration using the following commands on the Primary AND Standby
% tnsping PROD1
% tnsping SBDB1
a. Copy the password file from the primary $ORACLE_HOME/dbs and rename it to the standby database name.
The username is required to be SYS and the password needs to be the same on the Primary and Standby.
The best practice for this is to copy the passwordfile as suggested.
The password file name must match the instance name/SID used at the standby site, not the DB_NAME.
b. Create a initialization parameter with only one parameter DB_NAME.
DB_NAME=PROD1
DB_UNIQUE_NAME=SBDB1
DB_BLOCK_SIZE=
#####################################################################################
SBDB1.__db_cache_size=683671552
SBDB1.__java_pool_size=4194304
SBDB1.__large_pool_size=12582912
SBDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
SBDB1.__pga_aggregate_target=314572800
SBDB1.__sga_target=943718400
SBDB1.__shared_io_pool_size=0
SBDB1.__shared_pool_size=226492416
SBDB1.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/SBDB1/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/SBDB1/control01.ctl','/u01/app/oracle/fast_recovery_area/SBDB1/control02.ctl'
*.db_block_size=8192
*.db_cache_size=683671552
*.db_domain=''
*.db_name='PROD1'
*.db_recovery_file_dest_size=4294967296
*.db_recovery_file_dest='/home/oracle/flash'
*.DB_UNIQUE_NAME='SBDB1'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=SBDB1XDB)'
*.FAL_SERVER='PROD1'
*.java_pool_size=4194304
*.job_queue_processes=1000
*.large_pool_size=12582912
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(SBDB1,PROD1)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/home/oracle/flash
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=SBDB1'
*.LOG_ARCHIVE_DEST_2='SERVICE=PROD1 ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=PROD1'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.LOG_ARCHIVE_MAX_PROCESSES=30
*.LOG_FILE_NAME_CONVERT='SBDB1','PROD1'
*.open_cursors=300
*.pga_aggregate_target=314572800
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.result_cache_max_size=15728640
*.result_cache_mode='MANUAL'
*.sessions=335
*.sga_target=943718400
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.streams_pool_size=4194304
*.undo_tablespace='UNDOTBS1'
#####################################################################################
c. Create the necessary directories in the standby location to place database files and trace files ($ADR_HOME).
SQL> sho parameter diag
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
diagnostic_dest string /u01/app/oracle
d. Set the environment variable ORACLE_SID to the standby service and start the standby-instance.
SYS@SBDB1> create spfile from pfile;
File created.
SYS@SBDB1> startup nomount;
ORACLE instance started.
Total System Global Area 939495424 bytes
Fixed Size 2258840 bytes
Variable Size 352323688 bytes
Database Buffers 578813952 bytes
Redo Buffers 6098944 bytes
e. Verify if the connection 'AS SYSDBA' is working
[oracle@ORACLERAC2 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 27 16:09:04 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn sys/oracle@prod1 as SYSDBA;
Connected.
SQL> conn sys/oracle@sbdb1 as sysdba;
Connected.
f. On the primary system invoke the RMAN executable and connect to the primary and the auxiliary database ( i.e., the standby)
Connect to standby using SQL*Plus and start the MRP (Managed Recovery Process). Compare the primary last sequence and MRP (Managed Recovery Process) applying sequence.
Example :
If you are licensed to use Active Dataguard (ADG) than open the Standby Database in READ ONLY and start the recovery.
6. TEST
primary database:来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13750068/viewspace-2145529/ ,如需转载,请注明出处,否则将追究法律责任。