Create Standalone Oracle 10g Clone Database Using NetApp Snaps

Create a Flex Clone

  • Request networks to create a flex clone for the database volume
  • Get the name of the clone volume from networks

Mount the clone on the target server:

sudo su
vi /etc/fstab
nful0001-data:/vol/VOLUMEA_DATA /oradata/MYDB  nfs  
ping  nful0060-data
cd /oradata
mkdir MYDB
chown oracle:dba MYDB
mount /oradata/MYDB
exit

Check the volume is mounted correctly:

df -h

Create the dump directories:

cd $ORACLE_BASE/admin
mkdir MYDB
mkdir MYDB/bdump
mkdir MYDB/cdump
mkdir MYDB/adump
mkdir MYDB/udump

Create the pfile to point the spfile that is on the mounted volume, check pwd file:

cd $ORACLE_HOME/dbs
vi initMYDB1.ora
spfile='/oradata/MYDB/MYDB/spfileMYDB.ora'
ls /oradata/MYDB/MYDB/spfileMYDB.ora


--create symbolic link to the password file
cd $ORACLE_HOME/dbs
ln -s /oradata/MYDB/MYDB/orapwMYDB orapwMYDB1

Tidy up the tns entries:

Ensure that the db could not  connect to any live database by removing all tns entries to production database

Open in mount mode and disable all scheduler and dbms_jobs:

export ORACLE_SID=MYDB1
sqlplus / as sysdba
startup mount;
show parameter job_queue
alter system set job_queue_processes=0;

alter database open;
--(Recover db if neccessary)

Take a snap of the scheduler job status:

--disable all scheduler jobs

alter database open;
BEGIN
    DBMS_OUTPUT.ENABLE(9000000);
    FOR cur IN
        (SELECT 'BEGIN SYS.DBMS_SCHEDULER.STOP_JOB(JOB_NAME => ' || chr(39) || OWNER || '.' || JOB_NAME || chr(39) || ', FORCE => TRUE); END;' stmt,
        OWNER || '.' || JOB_NAME job_name
        FROM DBA_SCHEDULER_JOBS
        WHERE OWNER <> 'SYS')
    LOOP
        --DBMS_OUTPUT.PUT_LINE(cur.stmt);
        BEGIN
            EXECUTE IMMEDIATE(cur.stmt);
        EXCEPTION
        WHEN others THEN
            DBMS_OUTPUT.PUT_LINE('JOB NOT RUNNING ' || cur.job_name);
            --DBMS_OUTPUT.PUT_LINE(SQLERRM || ' CAUSE:' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
        END;
    END LOOP;
    FOR cur IN
        (SELECT 'BEGIN SYS.DBMS_SCHEDULER.DISABLE(NAME => ' || '''' || OWNER || '.' || JOB_NAME || '''' || ', FORCE => TRUE); END;' stmt,
        OWNER || '.' || JOB_NAME job_name
        FROM DBA_SCHEDULER_JOBS
        WHERE OWNER <> 'SYS')
    LOOP
        --DBMS_OUTPUT.PUT_LINE(cur.stmt);
        BEGIN
            EXECUTE IMMEDIATE(cur.stmt);
        EXCEPTION
        WHEN others THEN
            DBMS_OUTPUT.PUT_LINE('JOB NOT DISABLED ' || cur.job_name);
            --DBMS_OUTPUT.PUT_LINE(SQLERRM || ' CAUSE:' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
        END;
    END LOOP;
END;
/


--check if any job still running

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: