Skip to main content

How to duplicate from active database database to stand by with rman 11gr2

Oracle 11g introduces the "duplicate from active database database to stand by". This feature allows the creation of a stand by database without need a previous backup. The primary database need to be in archive mode.
This is possible by using one RMAN script. It will copy the server parameter file to the standby host, start the auxiliary instance using the server parameter file and will copy control, redologs  and datafiles over the network to the stand by host.




1- Create a single instance database (for this case, our primary database will be tst).

   Primary server     : 10.1.0.1
   Secondary server   : 10.1.0.2
  
   TNS alias for Primary – TST_PR
   TNS alias for standby – TST_DRP
  
   Primary DB_NAME Parameter=tst      Primary DB_UNIQUE_NAME Parameter=tst_pri
   Standby DB_NAME Parameter=tst      Standby DB_UNIQUE_NAME Parameter=tst_drp
  
   ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(ep0_pri,tst_drp)';
   alter system set db_unique_name='tst_pri' SCOPE=SPFILE;   (On primary server)
   alter system set db_unique_name='tst_drp' SCOPE=SPFILE;   (On stand by server)

  
   Check che changes :

   select db_unique_name from v$database;

   select name from v$database;


1.1- Enable the force logging on primary server

    SELECT force_logging FROM v$database;
    ALTER DATABASE FORCE LOGGING;
    SELECT force_logging FROM v$database; 
   
   
1.2 The primary databse must be in archive mode log, in case not do the following :

    shutdown immediate
    startup mount;
    alter database archivelog;
    alter database open;
   
1.3 You'll need a password file under $ORACLE_HOME/dbs (if is not already there) in primary server.
   

 orapwd file=orapwTST password=***** entries=30
   
Copy this password file from $ORACLE_HOME/dbs from primary server to stand-by server under same location.


4- Check entries in tnsnames.ora in both servers :


tnsnames.ora entries on primary server :


TST_PR =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.0.1)(PORT = 1529))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tst)
    )
  )
 

TST_DRP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.0.2)(PORT = 1529))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tst)
    )
  )


tnsnames.ora entries on secondary server :


TST_PR =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.0.1)(PORT = 1529))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tst)
    )
  )
 

TST_DRP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.0.2)(PORT = 1529))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tst)
    )
  )


5- Important : For this example, primary and stand-by database will have same structure.
               Both databases must be in archivelog mode.
               On stand by server must be created all same directories than primary server (datafiles, control files, tempfiles and redologs files directories)
               On stand by server on parameter file set this : *.log_file_name_convert=('/data5/oracle11/tst','/data5/oracle11/tst'), after duplicate, delete this entry from parameter file.
               In this case, redo log directories are same on both servers.



6- On the stand by server under $ORACLE_HOME/dbs create pfile/spfile entry


7 - Connect to the stand by server and perform a startup nomount

    export ORACLE_SID=tst
    sqlplus / as sysdba
    startup nomount
   
   
7.1 On primary database enable flash back database.

  7.1.1 Ensure db_recovery_file_dest is set.
        alter system set db_recovery_file_dest='/archive/tst/oraflash' SCOPE=spfile;
       
 7.1.2 Ensure db_recovery_file_dest_size is set
       alter system set db_recovery_file_dest_size=1G SCOPE=spfile;
      
 7.1.3 Enable flashback database
       alter database flashback on;     
   

7.1.3 Stop and start database in order the parameter takes change :

     sqlplus / as sysdba
      shutdown immediate
      startup
      show parameter db_recovery_file_dest
      show parameter db_recovery_file_dest_size
      select flashback_on from v$database;

8- Modify some parameter un primary servers :

alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tst_pri' scope=both;

alter system set LOG_ARCHIVE_DEST_STATE_1=enable scope=both;

alter system set log_archive_config='dg_config=(tst_pri,tst_drp)' scope=both;

alter system set log_archive_dest_2='service=tst_drp LGWR ASYNC valid_for=(online_logfile,primary_role) db_unique_name=tst_drp' scope=both;


In order the changes takes effect do the following :

shutdown immediate
startup


 9- On primary server perform the following command :

export ORACLE_SID=tst
rman target sys/******@TST_PR  auxiliary sys/******@TST_DRP   (The auxiliary is the stand-by entry)


10- After you connect succesfully in both databases, perform the following rman command :



run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate auxiliary channel stby type disk;

duplicate target database for standby from active database dorecover NOFILENAMECHECK;

release channel prmy1;
release channel prmy2;
release channel prmy3;
release channel stby;

}

Comments

Last Week Topics

How to Force The Database Open With `_ALLOW_RESETLOGS_CORRUPTION

This is an internal note from Oracle. Forcing The Database Open With `_ALLOW_RESETLOGS_CORRUPTION` with Automatic Undo Management ( Doc ID 283945.1 ) Warning The following instructions should only be used under the explicit direction of Oracle Support. These steps should only be used when all other conventional means of recovering the database have failed. Please note that there is no guarantee that this method will succeed. IF THE STEPS BELOW DO ALLOW YOU TO OPEN YOUR DATABASE THEN IT IS ESSENTIAL THAT THE DATABASE BE REBUILT AS IT IS NO LONGER SUPPORTED. FAILURE TO DO SO MAY LEAD TO DATA DICTIONARY INCONSISTENCIES, INTERNAL ERRORS AND CORRUPTIONS. ** Note: The steps here apply to Oracle 9i or higher and only and when Automatic Undo Management is being used. ** Steps to attempt to force the database open: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1) Backup the database while the database is closed. THE INSTRUCTIONS HERE ARE DESTRUCTIVE. YOU ARE STRONGLY A

HOW TO SHARE SAMBA SHARE FROM WINDOWS TO SOLARIS 11

SHARE WINDOWS FOLDER WITH SAMBA IN SOLARIS 11 OPEN THOSE PORT IF YOU HAVE A FIREWALL BETWEEN SERVERS PORT    STATE SERVICE 135/tcp open  msrpc 139/tcp open  netbios-ssn 445/tcp open  microsoft-ds 137 UDP 138 UDP INSTALL SAMBA PACKAGES #pkg install samba ENABLE EACH SERVICES AFTER INSTALLING SAMBA AND CONFIGURE THE SMB.CONF #svcadm enable idmap #svcadm enable smb/client #svcadm enable samba root@:/# vi /etc/samba/smb.conf [ftps]   path = //april.domaintest/FTPS   realm = april.domaintest.com   netbios name = april   passdb backend = YourSharingPassword   guest account = SAMBAUX   log file = /var/samba/log/%m.log   load printers = No   wins server = YourWinServer    winbind trusted domains only = No   workgroup = domaintest.com   hosts allow = 192.168.1.10    TEST THE CONNECTION WITH WINDOWS SAMBA SERVER SHARE     root@:/#  smbclient -L //april/FTPS/ -s /etc/samba/smb.conf -N Anonymous login successful         Sharename       Ty

HOW TO CHANGE HOSTNAME RED HAT LINUX

HOW TO CHANGE HOSTNAME RED HAT LINUX 1.-Validate Hostname and host file that you need to change #hostname rhel #cat /etc/hosts 127.0.0.1  localhost 192.168.1.13  rhel 2.-Edit the following file in order to change HOSTNAME #vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=TEST GATEWAY=192.168.1.1 3.-When you are ready and you save the information you will need to edit the hosts file #vi /etc/hosts 127.0.0.1  localhost 192.168.1.13  test 4.- Finally you will need to restart de network services #service network restart #hostname test

How to reorganize tables with brspace commands.

Brspace use internally Oracle DBMS_REDEFINITION. If you have SAP with Oracle, this is a very fast way to reorganize object in Oracle Database. In this example we will organize simultaneously S562,MLPPF and MLCRP tables. Important : If you want to reorganize various tables and indexes, these must reside in same tablespace. 1- Tables reorganization. brspace -p /oracle/PRD/102_64/dbs/initPRD.sap -c force -s 20 -l E -f tbreorg -a reorg -s PSAPSR3 -o SAPSR3 -t "S562,MLPPF,MLCRP" -n PSAPSR3 -e 16 -p 16 -m online *  /oracle/PRD/102_64/dbs/initPRD.sap : SAP Parameter file * PSAPSR3 : Source tablespace * SAPSR3  : Table owner * PSAPSR3 :  Destiny tablespace. * -e 16 -p 16 -m :  It indicates how many parallel processes that will perform the operation,in this case are 16. * online : It indicates that the reorganization of the tables will be made ONLINE 2- After tables reorganization you will need to rebuild the S562,MLPPF and MLCRP indexes tables . brspac

How to break a bonded network interface red hat

1.- Bonding device called bond0 which aggregated by eth0 and eth1 # ifconfig bond0     Link encap:Ethernet  HWaddr 44:a8:42:5d:6d:5d           inet addr:192.168.1.51  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::5054:ff:fe4d:9004/64 Scope:Link           UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1 eth0      Link encap:Ethernet  HWaddr 44:a8:42:5d:6d:5d           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1 eth2      Link encap:Ethernet  HWaddr 44:a8:42:5d:76:29           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1           RX packets:6 errors:0 dropped:0 overruns:0 frame:0 # cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009) Bonding Mode: fault-tolerance (active-backup) Primary Slave: em1 (primary_reselect always) Currently Active Slave: em1 MII Status: up MII Polling Interval (ms): 50 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 10000

HOW TO ENABLE A VIRTUAL INTERFACE (VNIC) SOLARIS 10

HOW TO ENABLE A VIRTUAL INTERFACE (VNIC) SOLARIS 10 1.-Verify the interfaces on the server that you need to add the ip in this example 10.1.1.8 # dladm show-phys LINK CLASS MTU STATE OVER bge0 phys 1500 unknown -- bge1 phys 1500 up --    2.-Now you need to create a virtual network interface or VNIC on the server #ifconfig bge1:1 plumb #ifconfig -a 3.-Finally you can add the new ip address and add on the server in /etc/hostname.bge1:1 the IP or the name that you defined on the hosts file with that ip #vi /etc/hostname.bge1:1 10.1.1.8 #ifconfig bge1:1 10.1.1.8 netmask 255.255.255.0 broadcast 10.1.1.254 up Regards Roger    

How to install Oracle Directory Server 11 Solaris 10

Createl DSCC Registry that is   Directory Server Manager for LDAP server administration root@ldapserv1:/opt/ODSEE_ZIP_Distribution/dsee7/bin# ./dsccsetup ads-create Choose password for Directory Service Manager: Confirm password for Directory Service Manager: Creating DSCC registry... DSCC Registry has been created successfully Deploy the directory server root@ldapserv1:/opt/ODSEE_ZIP_Distribution/dsee7/bin# ./dsccsetup war-file-create Created /opt/ODSEE_ZIP_Distribution/dsee7/var/dscc7.war 1636 /opt/dsInst Choose the Directory Manager password: <Password Directory Manager> Confirm the Directory Manager password: <Password Directory Manager> Starting the instance created with dsadm Use command 'dsadm start '/opt/dsInst'' to start the instance oot@ldapserv1:/opt/ODSEE_ZIP_Distribution/dsee7/bin# ./dsadm start '/opt/dsInst' Directory Server instance '/opt/dsInst' started: pid=19325 Create the suffix   and port that will be used,

HOW TO INSTALL JAVA IN SOLARIS 11 OR SOLARIS 11 ZONES

1.-Set proxy with user and password if you have proxy with authentication or without it #export https_proxy=https://sun:sun@192.168.100.100:8080 #export http_proxy=http://sun:sun@192.168.2.100.100:8080 2.- Set publisher in order to use the Oracle Support Repository #pkg set-publisher -k  /var/pkg/ssl/pkg.oracle.com.key.pem -c /var/pkg/ssl/pkg.oracle.com.certificate.pem -g https://pkg.oracle.com/solaris/support/  solaris 3.-You can search the packages availables in my case I need to install JAVA 8 #pkg search -p java PACKAGE                                                                 PUBLISHER pkg:/SUNWj6cfg@1.6.0.999.99                                             solaris pkg:/SUNWj6dev@1.6.0.999.99                                             solaris pkg:/SUNWj6dmo@1.6.0.999.99                                             solaris pkg:/SUNWj6dmx@1.6.0.999.99                                             solaris pkg:/SUNWj6dvx@1.6.0.999.99         

HOW TO ADD A LINE WITH ANSIBLE WITH TAB SPACE IN A FILE

-bash-4.2# vi add_line_syslog.yml --- - name: script in order to add in the server list below with TAB spaces a Line in the SYSLOG CONF   hosts: oraking   tasks:     - name: Add a Line  in /etc/syslog.conf in order to delivery that information to another server       lineinfile:         path: /etc/syslog.conf         line: " *.err;auth.notice;auth.info;local0.info \t\t @10.10.10.200 "         insertbefore: ' \*.alert;kern.err;daemon.err '     - name: Restart system-log       command: /usr/sbin/svcadm restart svc:/system/system-log:default