SQL> select FORCE_LOGGING from v$database; FOR --NO SQL> archive log list Database log mode Archive Mode

Automatic archival Enabled Archive destination /u03/oradata/car/arc Oldest online log sequence 5 Next log sequence to archive 6 Current log sequence 6 SQL> SQL> alter database force logging; Database altered. SQL> select * from v$pwfile_users; no rows selected SQL> Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n> where file - name of password file (mand), password - password for SYS (mand), entries - maximum number of distinct DBA and force - whether to overwrite existing file (opt), OPERs (opt), There are no spaces around the equal-to (=) character. bash-3.00$ orapwd file=orapwcar password=car entries=5 force=y bash-3.00$ ls *car* initcar.ora orapwcar spfilecar.ora SQL> show parameter remote NAME TYPE VALUE ------------------------------------ ----------- -----------------------------remote_archive_enable string true remote_dependencies_mode string TIMESTAMP

remote_listener string remote_login_passwordfile string EXCLUSIVE remote_os_authent boolean FALSE remote_os_roles boolean FALSE SQL> REMOTE_LOGIN_PASSWORDFILE specifies whether Oracle checks for a password file. Values: shared One or more databases can use the password file. The password file can contain SYS as well as non-SYS users. exclusive The password file can be used by only one database. The password file can contain SYS as well as non-SYS users. none Oracle ignores any password file. Therefore, privileged users must be authenticated by the operating system. Note: When REMOTE_LOGIN_PASSWORDFILE is set to either exclusive or shared, but the password file does not exist, then the behavior is the same as setting REMOTE_LOGIN_PASSWORDFILE to none. Configure a Standby Redo log. The size of the standby redo log files should match the size of the current Primary database online redo log files. To find out the size of your online redo log files: SQL> select (bytes/1024)/1024 from v$log; (BYTES/1024)/1024 ----------------100 100 SQL> select group#,member from v$logfile; GROUP# MEMBER ---------- ----------------------------------1 /u03/oradata/car/r1a.log 1 /u03/oradata/car/r1b.log 2 /u03/oradata/car/r2a.log 2 /u03/oradata/car/r2b.log SQL> SQL> alter database add standby logfile group 3 ('/u03/oradata/stan/red1a.log','/u03/oradata/stan/red2b.log') size 100m;

Database altered. SQL> alter database add standby logfile group 4 ('/u03/oradata/stan/red1c.log','/u03/oradata/stan/red2d.log') size 100m; Database altered. SQL> select GROUP#,STATUS from v$standby_log; GROUP# STATUS ---------- ---------3 UNASSIGNED 4 UNASSIGNED SQL> create pfile from spfile; File created. db_name=PRIM db_unique_name=PRIM LOG_ARCHIVE_CONFIG='DG_CONFIG=(PRIM,STAN)' LOG_ARCHIVE_CONFIG enables or disables the sending of redo logs to remote destinations and the receipt of remote redo logs, and specifies the unique database names (DB_UNIQUE_NAME) for each database in the Data Guard configuration. Values: SEND Enables the sending of redo logs to remote destinations NOSEND Disables the sending of redo logs to remote destinations RECEIVE Enables the receipt of remotely archived redo logs NORECEIVE Disables the receipt of remotely archived redo logs DG_CONFIG Specifies a list of up to 9 unique database names (defined with the DB_UNIQUE_NAME initialization parameter) for all of the databases in the Data Guard configuration. NODG_CONFIG Eliminates the list of service provider names previously specified with the DG_CONFIG option. LOG_ARCHIVE_DEST_1=

'LOCATION=F:\Oracle\flash_recovery_area\PRIM\ARCHIVELOG The archiver process (ARCn ) or log writer process (LGWR) can be configured to archive online redo logs to a maximum of 10 destinations. These destinations are specified using the LOG_ARCHIVE_DEST_n (where n is a number from 1 to 10) database initialization parameter. One destination must be a local directory, but others can be at remote destinations. A remote destination is identified by an Oracle Net network service name, which is defined in the appropriate network services configuration files. Archiving redo logs to a remote destination requires uninterrupted connectivity through Oracle Net. If the destination is a remote physical standby database, it must be mounted or open in read-only mode to receive the archived redo logs. VALID_FOR=(ALL_LOGFILES,ALL_ROLES) The valid_for attribute takes two parameters, the archival_source parameter and the database_role parameter. The archival_source parameter defines when the destination is used. Valid settings for this parameter are as follows: ONLINE_LOGFILE This destination is used only when archiving online redo log files. This destination is not used when archiving standby redo log files, or if log files are being received from another database. STANDBY_LOGFILE This destination is used only when standby redo log files are being archived or if archived redo logs are being received from another database. ALL_LOGFILES This destination can be used in either role, archiving online or standby redo log files. The database_role parameter is the second parameter of the valid_for attribute. As the name implies, this parameter defines the role of the database that the parameter is associated with and, thus, when the archive log destination will be used. Valid settings for this parameter are as follows: PRIMARY_ROLE This destination is used only when the database is in the primary database role. STANDBY_ROLE This destination is used only when the database is in a standby role. This applies to both physical and logical standby databases. ALL_ROLES Open the barn doors Bessie! This destination is used if the database is in primary or standby mode.

DB_UNIQUE_NAME=PRIM' LOG_ARCHIVE_DEST_2= 'SERVICE=STAN LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STAN' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE LOG_ARCHIVE_FORMAT=%t_%s_%r.arc LOG_ARCHIVE_MAX_PROCESSES=30 Parameter type Default value Modifiable Range of values Basic Integer 2 ALTER SYSTEM 1 to 30 No

LOG_ARCHIVE_MAX_PROCESSES specifies the number of archiver background processes (ARC0 through ARC9) Oracle initially invokes. remote_login_passwordfile='EXCLUSIVE' FAL_SERVER=STAN FAL_SERVER specifies the FAL (fetch archive log) server for a standby database. The value is an Oracle Net service name, which is assumed to be configured properly on the standby database system to point to the desired FAL server. FAL_CLIENT=PRIMCAR FAL_CLIENT specifies the FAL (fetch archive log) client name that is used by the FAL service, configured through the FAL_SERVER parameter, to refer to the FAL client. The value is an Oracle Net service name, which is assumed to be configured properly on the FAL server system to point to the FAL client (standby database).

STANDBY_FILE_MANAGEMENT=AUTO STANDBY_FILE_MANAGEMENT enables or disables automatic standby file management. When automatic standby file management is enabled, operating system file additions and deletions on the primary database are replicated on the standby database. Values: MANUAL disables automatic standby file management AUTO enables automatic standby file management

DB_FILE_NAME_CONVERT='E:\oracle\product\10.2.0\oradata\STAN\DATAFILE','E:\ oracle\product\10.2.0\oradata\PRIM\DATAFILE' DB_FILE_NAME_CONVERT is useful for creating a duplicate database for recovery purposes. It converts the filename of a new datafile on the primary database to a filename on the standby database. If you add a datafile to the primary database, you must add a corresponding file to the standby database. When the standby database is updated, this parameter converts the datafile name on the primary database to the datafile name on the standby database. The file on the standby database must exist and be writable, or the recovery process will halt with an error. LOG_FLE_NAME_CONVERT=’E:\oracle\product\10.2.0\oradata\STAN\ONLINELOG’, ’E:\oracle\product\10.2.0\oradata\PRIM\ONLINELOG’,’F:\Oracle\flash_recovery_area \STAN\ONLINELOG’,’F:\ Oracle\flash_recovery_area\PRIM\ONLINELOG’ LOG_FILE_NAME_CONVERT converts the filename of a new log file on the primary database to the filename of a log file on the standby database. If you add a log file to the primary database, you must add a corresponding file to the standby database SQL>STARTUP ORACLE instance started. Total System Global Area 104857600 bytes Fixed Size 1217932 bytes Variable Size 96471668 bytes Database Buffers 4194304 bytes Redo Buffers 2973696 bytes Database mounted. Database opened. SQL> CREATE SPFILE FROM PFILE;

SQL>STARTUP FORCE ORACLE instance started. Total System Global Area 104857600 bytes Fixed Size 1217932 bytes Variable Size 96471668 bytes Database Buffers 4194304 bytes Redo Buffers 2973696 bytes Database mounted. Database opened. SQL> show parameter spfile; NAME TYPE VALUE ------------------------------------ ----------- -----------------------------spfile string /u01/app/oracle/product/10.2.0 /db_1/dbs/spfilecar.ora SQL> SHUTDOWN IMMEDIATE Database closed. Database dismounted. ORACLE instance shut down. SQL> Create a copy of Primary database data files on the Standby Server: Copy the data files and temp files over. Copy the online logs over. SQL> startup mount ORACLE instance started. Total System Global Area 104857600 bytes Fixed Size 1217932 bytes Variable Size 96471668 bytes Database Buffers 4194304 bytes Redo Buffers 2973696 bytes Database mounted. SQL> alter database create standby controlfile as '/u03/oradata/stan/stan.ctl'; Database altered. SQL> alter database open; Database altered.

Copy the Primary DB pfile to Standby server and rename/edit the file. bash-3.00$ cp spfilecar.ora spfilestan.ora bash-3.00$ scp spfilestan.ora ocvmrh2118:$ORACLE_HOME/dbs spfilestan.ora 100% 3584 3.5KB/s 00:00 Rename it to pfileSTAN.ora, and modify the file as follows. : (Here the file paths are from a windows system. For UNIX system, specify the path accordingly) **.background_dump_dest='/u01/app/admin/stan/bdump' *.compatible='10.2.0' *.control_files='/u03/oradata/stan/stan.ctl','/u03/oradata/stan/stand.ctl' *.core_dump_dest='/u01/app/admin/stan/cdump' *.db_block_buffers=100# SMALL *.db_file_multiblock_read_count=8# SMALL *.DB_FILE_NAME_CONVERT='/u03/oradata/car','/u03/oradata/stan' *.db_files=80# SMALL *.db_name='car' *.db_unique_name=stan *.FAL_CLIENT=stan *.FAL_SERVER=car *.instance_name='car' *.log_archive_config='DG_CONFIG=(PRIM,STAN)' *.log_archive_dest_1='LOCATION=/u03/oradata/stan/arc VALID_FOR=(ALL_LOGFILES,ALL_ROLES) db_unique_name=stan' *.log_archive_dest_2='SERVICE=car LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=car' *.LOG_ARCHIVE_DEST_STATE_1='ENABLE' *.LOG_ARCHIVE_DEST_STATE_2='ENABLE' *.LOG_ARCHIVE_MAX_PROCESSES=30 *.log_buffer=32768# SMALL *.log_checkpoint_interval=10000 *.LOG_FiLE_NAME_CONVERT='/u03/oradata/car','/u03/oradata/stan' *.max_dump_file_size='10240'# limit trace file size to 5 Meg each *.parallel_max_servers=5# SMALL *.processes=50# SMALL *.shared_pool_size=67232153# SMALL *.STANDBY_FILE_MANAGEMENT='AUTO' *.undo_management='auto' *.undo_retention=900 *.undo_tablespace='undotbs'

*.user_dump_dest='/u01/app/admin/stan/udump' (Note: Not all the parameter entries are listed here. For DB_FILE_NAME_CONVERT - Specify the location of the primary DB datafiles followed by the standby location; For LOG_FILE_NAME_CONVERT - Specify the location of the primary DB online redo log files followed by the standby location) SERVER>show parameter fal NAME TYPE VALUE ------------------------------------ ----------- -----------------------------fal_client string PRIMCAR fal_server string STAN SQL> alter system set fal_client=CAR; System altered. SQL> show parameter fal NAME TYPE VALUE ------------------------------------ ----------- -----------------------------fal_client string CAR fal_server string STAN On Standby server, create all required directories for dump and archived log destination: Copy the standby control file ‘STAN.ctl’ from primary to standby destinations ; Copy the Primary password file to standby and rename it to pwdSTAN.ora. On Primarysystem: use Oracle Net Manager to configure a listener for PRIM and STAN. Then restart the listener. On Standby server: use Net Manager to configure a listener for PRIM and STAN. Then restart the listener. Create Oracle Net service names. On Primary system: use Oracle Net Manager to create network service names for PRIM and STAN. Check tnsping to both services:

$tnsping PRIM $tnsping STAN On Standby system: use Oracle Net Manager to create network service names for PRIM and STAN. Check tnsping to both services: $tnsping PRIM $tnsping STAN On Standby server, setup the environment variables to point to the Standby database. Set up ORACLE_HOME and ORACLE_SID. Start up nomount the standby database and generate a spfile. SQL> startup nomount ORACLE instance started. Total System Global Area 104857600 bytes Fixed Size 1217932 bytes Variable Size 96471668 bytes Database Buffers 4194304 bytes Redo Buffers 2973696 bytes SQL> create spfile from pfile; File created. SQL> shutdown ORA-01507: database not mounted ORACLE instance shut down. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options bash-3.00$ sqlplus SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 24 07:12:55 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Enter user-name: /as sysdba Connected to an idle instance.

SQL> startup mount ORACLE instance started. Total System Global Area 104857600 bytes Fixed Size 1217932 bytes Variable Size 96471668 bytes Database Buffers 4194304 bytes Redo Buffers 2973696 bytes Database mounted. SQL> On the standby database, to start redo apply: SQL> alter database recover managed standby database disconnect from session; Database altered. If you ever need to stop log apply services: SQL> alter database recover managed standby database cancel; If you want the redo data to be applied as it is received without waiting for the current standby redo log file to be archived, enable the real-time apply.

Sign up to vote on this title
UsefulNot useful