Using SYSBACKUP to create a Standby Database

Version 1

    Check the Password File

     

     

    First check the password file. If there's any doubt about it recreate it.

     

     

    SQL> select * from v$pwfile_users;

     

    USERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM CON_ID

    ------------------------------ ----- ----- ----- ----- ----- ----- ----------

    SYS TRUE  TRUE  FALSE FALSE FALSE FALSE          0

     

     

    Create a New Password File

     

     

    Note the ignorecase=y, sysbackup=y and  sysdg=y options.

     

    orapwd file=$ORACLE_HOME/dbs/orapwPRIMARY password=<top_secret> entries=5 force=y ignorecase=y sysbackup=y  sysdg=y

     

    ( This will prompt you for passwords for the sysbackup and sysdg )

     

     

    Unlock the SYSBACKUP and SYSDG users

     

    alter user sysbackup account unlock;

    alter user sysdg account unlock;

     

     

    Create the New Users

     

     

    CREATE USER BACKUPADMIN

      IDENTIFIED BY <password>

      DEFAULT TABLESPACE USERS

      TEMPORARY TABLESPACE TEMP

      PROFILE DEFAULT

      ACCOUNT UNLOCK;

     

     

    CREATE USER DGA

      IDENTIFIED BY <password>

      DEFAULT TABLESPACE USERS

      TEMPORARY TABLESPACE TEMP

      PROFILE DEFAULT

      ACCOUNT UNLOCK;

     

    Note: The Grants below had to be done as SYSDBA

     

     

    GRANT SYSBACKUP TO BACKUPADMIN;

     

    GRANT SYSDG TO DGA;

     

    Once these grants are complete the password file will contain four new users. If you check it before the grants it will only have two new users. Granting SYSBACKUP or SYSDG adds the last two users.

     

     

    SQL> select * from v$pwfile_users;

     

    USERNAME      SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM           CON_ID

    ------------------------------ ----- ----- ----- ----- ----- ----- ----------

    SYS            TRUE  TRUE  FALSE FALSE FALSE FALSE          0

    SYSBACKUP      FALSE FALSE FALSE TRUE  FALSE FALSE          0

    SYSDG          FALSE FALSE FALSE FALSE TRUE FALSE           0

    DGA            FALSE FALSE FALSE FALSE TRUE FALSE           0

    BACKUPADMIN    FALSE FALSE FALSE TRUE  FALSE FALSE          0

     

    Note the limited security for the new users.

     

    SCP the password file to the remote server. I generally rename it as part of the scp command.

     

     

    Part Two - RMAN Duplicate

     

    This section assumes you had made you INIT file changes and creation on the standby side. You have your folders setup and your tnsnames and listener files on both servers are correct for Data Guard.

     

    On the standby side startup nomount with the new spfile.

     

    startup nomount

     

     

     

    Start RMAN and then connect to both databases and run the duplicate command.

     

    /home/oracle:STANDBY >$ORACLE_HOME/bin/rman

     

     

    RMAN> connect target 'BACKUPADMIN/********@PRIMARY as sysbackup'

     

    connected to target database: PRIMARY (DBID=1644161450)

     

    RMAN> connect auxiliary 'BACKUPADMIN/********@STANDBY as sysbackup'

     

    connected to auxiliary database: PRIMARY (not mounted)

     

    Finally run the duplicate command.

     

     

    RMAN> duplicate target database for standby from active database NOFILENAMECHECK;

     

     

    Common RMAN Error

     

    ORA-17627: ORA-01017: invalid username/password; logon denied

     

    Generally this means there's an issue with one or both password files.

     

    Hope this helps!