Skip to content

Archive for

Happy New Year 2011

Advertisements

Can we use Flashback database If noarchivelog exists

Can we use flashback database log after switching from archivelog mode to noarchivelog mode and back to archivelog mode?

According to Metalink Note ID.[ID 454768.1]

We cannot, because when we turn off flashback database, you lose the flashback logs unless they are guaranteed

If they guaranteed, We can’t alter no archivelog mode

Let us see some example :

Step 1: Ensure Flashback ON

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

Step 2:

SQL> conn flashown/flashown;
Connected.
SQL> create table employee as select * from scott.emp;

Table created.

SQL> update employee set sal=sal+50;

14 rows updated.

SQL> commit;

Commit complete.

SQL> create restore point azar;

Restore point created.

SQL> update employee set sal=sal+50;

14 rows updated.

SQL> commit;

SQL>select current_timestamp from dual;

CURRENT_TIMESTAMP
---------------------------------------------------------------------------
19-DEC-10 09.53.55.726000 AM +03:00

Step 3: alter noarchivelog mode

SQL> shutdown immediate
ORACLE instance shut down.
SQL> startup mount
Database mounted.

SQL> alter database noarchivelog;
alter database noarchivelog
*
ERROR at line 1:
ORA-38774: cannot disable media recovery - flashback database is enabled
SQL> alter database flashback off;

Database altered.

SQL> alter database noarchivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> update flashown.employee set sal=sal+50;

14 rows updated.

SQL> commit;

Commit complete.

Step 4: Again back to archivelog mode & Recover flashback database But we can’t.

SQL> shutdown immediate
ORACLE instance shut down.
SQL> startup mount
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database flashback on;

Database altered.

SQL> flashback database to restore point azar;
flashback database to restore point azar
*
ERROR at line 1:
ORA-38729: Not enough flashback database log data to do FLASHBACK.
SQL> flashback database to timestamp to_date('19-DEC-10 09.54.00','DD-MM-YY HH24:MI:SS');
flashback database to timestamp to_date('19-DEC-10 09.54.00','DD-MM-YY HH24:MI:SS')
                                                             *
ERROR at line 1:
ORA-38729: Not enough flashback database log data to do FLASHBACK.

 

Step 5: Create Guarantee Restore point

SQL> show parameter db_flashback_retention_target;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target        integer     1440
SQL> create restore point azardb guarantee flashback database;

Restore point created.

SQL> alter database open;

Database altered.

SQL> select sal from flashown.employee;

       SAL
----------
       955
      1755
      1405
      3130
      1405
      3005
      2605
      3255
      5155
      1655
      1255

       SAL
----------
      1105
      3155
      1455

14 rows selected.

SQL> select current_timestamp from dual;

CURRENT_TIMESTAMP
---------------------------------------------------------------------------
19-DEC-10 10.11.43.716000 AM +03:00

SQL> update flashown.employee set sal=sal-5;

14 rows updated.

SQL> commit;

Commit complete.

SQL> shutdown immediate
ORACLE instance shut down.
SQL> startup mount
Database mounted.
SQL> alter database flashback off;

Database altered.

SQL> alter database noarchivelog;
alter database noarchivelog
*
ERROR at line 1:
ORA-38781: cannot disable media recovery - have guaranteed restore points
SQL> alter database flashback on;

Database altered.

SQL> flashback database to timestamp to_date('19-DEC-10 10.11.44','DD-MM-YY HH24:MI:SS');

Flashback complete.

SQL> alter database open resetlogs;

Database altered.

SQL> select sal from flashown.employee;

       SAL
----------
       955
      1755
      1405
      3130
      1405
      3005
      2605
      3255
      5155
      1655
      1255

       SAL
----------
      1105
      3155
      1455

14 rows selected.
SQL>

So we can’t alter noarchivelog mode While Guarantee restore point exists in DB.

And the If flashback database off,  we can’t recover flashback database using flashback logs.

Recover dropped user using Flashback database

Here I demonstrated How to recovered dropped user using flashback database without data loss.

Condition:

  • Archivelog Mode
  • Flashback Mode Enabled
  • Time at which user dropped should be within the db_flashback_retention_target and all the flashback and archivelogs should be available
  • There should not be any NOLOGGING operation for any of the objects in that user’s schema.

Step 1: Check Flashback Mode  & Retention Period


SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

SQL> show parameter flash;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_flash_cache_file                  string
db_flash_cache_size                  big integer 0
db_flashback_retention_target        integer     1440

Step 2: Create the user

SQL> create user flashtest identified by flashtest default tablespace testdb;

User created.

SQL> grant connect,resource,dba to flashtest;

Grant succeeded.

SQL> conn flashtest/flashtest;
Connected.
SQL> create table emp(ename varchar2(20),city varchar2(20));

Table created.

SQL> insert into emp values('azar','riyadh');

1 row created.

SQL> insert into emp values('kareem','dubai');

1 row created.

SQL> insert into emp values('azmi','chennai');

1 row created.

SQL> insert into emp values('idress','riyadh');

1 row created.

SQL> insert into emp values('ajmal','chennai');

1 row created.

SQL> commit;

Commit complete.

SQL> select current_timestamp from dual;

CURRENT_TIMESTAMP
---------------------------------------------------------------------------
18-DEC-10 12.14.21.137000 PM +03:00

Step 3: Drop the user

SQL> conn / as sysdba
Connected.
SQL> drop user flashtest cascade;

User dropped.

Step 4: startup mount stage & then flashback the database with timestamp

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size                  1375792 bytes
Variable Size             335544784 bytes
Database Buffers          192937984 bytes
Redo Buffers                5804032 bytes
Database mounted.
SQL>  flashback database to timestamp to_date('18-DEC-10 12.14.22','DD-MM-YY HH24:MI:SS');

Flashback complete.

Step 5: Open database read only mode

SQL> alter database open read only;

Database altered.

SQL> conn flashtest/flashtest;
Connected.
SQL> select * from emp;

ENAME                CITY
-------------------- --------------------
azar                 riyadh
kareem               dubai
azmi                 chennai
idress               riyadh
ajmal                chennai

Step 6: Export USER data

C:\Users\mazar>exp flashtest/flashtest file=d:\backup\emp.dmp log=d:\backup\emp.log direct=y consistent=y statistics='none'

Export: Release 11.2.0.1.0 - Production on Sat Dec 18 12:17:52 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in AR8MSWIN1256 character set and AL16UTF16 NCHAR character set

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user FLASHTEST
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user FLASHTEST
About to export FLASHTEST's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export FLASHTEST's tables via Direct Path ...
. . exporting table                            EMP          5 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.

Step 7: shutdown & startup mount , recover database

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size                  1375792 bytes
Variable Size             335544784 bytes
Database Buffers          192937984 bytes
Redo Buffers                5804032 bytes
Database mounted.
SQL> recover database;
Media recovery complete.
SQL> alter database open;

Database altered.

SQL> conn flashtest/flashtest;
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.

Step 8: create user again

SQL> conn / as sysdba
Connected.
SQL> create user flashtest identified by flashtest default tablespace testdb;

User created.

SQL> grant connect,resource,dba to flashtest;

Grant succeeded.

Step 9: Import User data

C:\Users\mazar>imp flashtest/flashtest file=d:\backup\emp.dmp log=d:\backup\emp.log full=y

Import: Release 11.2.0.1.0 - Production on Sat Dec 18 12:20:06 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via direct path
import done in AR8MSWIN1256 character set and AL16UTF16 NCHAR character set
. importing FLASHTEST's objects into FLASHTEST
. . importing table                          "EMP"          5 rows imported
Import terminated successfully without warnings.

Step 10: Check Data Either avilable or not.

C:\Users\mazar>

SQL> conn flashtest/flashtest;
Connected.
SQL> select * from emp;

ENAME                CITY
-------------------- --------------------
azar                 riyadh
kareem               dubai
azmi                 chennai
idress               riyadh
ajmal                chennai

SQL>

Okay.Now I successfully recovered dropped user without data loss.

Flashback Data Archive

Flashback Data archive is one of the Oracle 11g feature (Oracle Total Recall).

A flashback data archive is a logical container for storing historical information. It is stored in one or more tablespaces and tracks the history for one or more tables.

Retention Period :

The archive administrator creates a flashback data archive named fla1, which uses up to unlimited of the <tablespacename> tablespace and whose data will be retained for one years. If you want to set up your database so that information in the fla1 is automatically deleted, the day after 1 years is complete.

Archive Administrator Privilege :

  • Create Flashback Archive
  • Alter flashabck archive
  • Drop flashback archive

A new Background process invloved FBDA

1. FBDA operates first on the undo in the buffer cache.
2. In case the undo has already left the buffer cache, FBDA could also read the required values from the undo segments.
3. FBDA consolidates the modified rows of flashback archive–enabled tables and writes them into the appropriate history tables, which make up the flashback data archive.

Views :

*_FLASHBACK_ARCHIVE_TABLES

*_FLASHBACK_ARCHIVE

*_FLASHBACK_ARCHIVE_TS

Here * indicates, you specify DBA, USERS, ALL

How to Enable Flashback Data Archive;

Step 1:  Conn AS sys user & create tablespace

SQL> select flashback_on from v$database;

FLASHBACK_ON

SQL> create tablespace flashbacktbs datafile 'D:\backup\flbtbs01.dbf' size 50m autoextend on;

Tablespace created.
------------------
YES

Step 2: Create Flashback Data Archive with retention period


SQL> create flashback archive fla1 tablespace flashbacktbs retention 1 year;

Flashback archive created.

Step 3:


SQL> conn scott/tiger;
Connected.
SQL> alter table emp flashback archive fla1;
alter table emp flashback archive fla1
*
ERROR at line 1:
ORA-55620: No privilege to use Flashback Archive

So Need to give privilege for scott user

Step 4: Grant privilege

SQL> conn sys/Admin123 as sysdba
Connected.

SQL> grant flashback archive on fla1 to scott;

Grant succeeded.

Step 5:


SQL> conn scott/tiger;
Connected.
SQL> alter table emp flashback archive fla1;

Table altered.

Step 6:

SQL> select empno,ename,sal from emp where empno=7788;

     EMPNO ENAME             SAL
---------- ---------- ----------
      7788 SCOTT            3000

SQL> select current_timestamp from dual;

CURRENT_TIMESTAMP
---------------------------------------------------------------------------
18-DEC-10 10.53.41.521000 AM +03:00

SQL>  update emp set sal=sal+100 where empno=7788;

1 row updated.

SQL>  select sal from emp as of timestamp to_timestamp('18-DEC-10 10:53:41','DD-MM-YY HH24:MI:SS')  WHERE EMPNO=7788;

       SAL
----------
      3000

SQL> select empno,ename,sal from emp where empno=7788;

     EMPNO ENAME             SAL
---------- ---------- ----------
      7788 SCOTT            3100

Some Other operations:

Modify Retention Period:

SQL>  alter flashback archive FLA1 modify retention 2 year;

Flashback archive altered.

Purge all data

SQL> alter flashback archive FLA1 purge all;

Flashback archive altered.

Disable Falshback data archive for table

SQL> alter table scott.emp no flashback archive;

Table altered.

ADD/MODIFY/REMOVE tablespace

SQL> alter flashback archive fla1 add tablespace testdb;

Flashback archive altered.

Ref :

Metalink Note [ID 470199.1]

Duplicate database from ASM to non ASM

Download PDF Document from here


Duplicate Database from ASM to Non pdf

Right click on thir URL, Save Target as & then Download it.


Step 1:

Determine how much disk space will be required.

SQL> select name from v$database;

NAME
---------
AZARDB

Calculate total space for all datafiles within database

SQL> select DF.TOTAL/1048576 "DataFile Size Mb",LOG.TOTAL/1048576 "Redo Log Size Mb",CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb" from dual,(select sum(a.bytes) TOTAL from dba_data_files a) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL ;

DataFile Size Mb Redo Log Size Mb
---------------- ----------------
Control File Size Mb Total Size Mb
-------------------- -------------
1310              150
18.59375    1478.59375

Calculate space for list of datafiles within primary database

SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
CONTROL.TOTAL/1048576 "Control File Size Mb",
(DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 "Total Size Mb" from dual,
(select sum(a.bytes) TOTAL from dba_data_files a where tablespace_name in ('SYSTEM','SYSAUX','UNDO','USERS')) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG,
(select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL ;

DataFile Size Mb Redo Log Size Mb
---------------- ----------------
Control File Size Mb Total Size Mb
-------------------- -------------
1165              150
18.59375    1333.59375

Step 2: backup Source database

RMAN> run{
2> allocate channel d1 type disk;
3> backup format '/backups/df_t%t_s%s_p%p' database;
4> sql 'alter system archive log current';
5> backup format '/backups/al_t%t_s%s_p%p' archivelog all;
6> release channel d1;
7> }

released channel: ORA_DISK_1
allocated channel: d1
channel d1: SID=44 device type=DISK

Starting backup at 17-DEC-10
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/azardb/datafile/system.256.736179685
input datafile file number=00002 name=+DATA/azardb/datafile/sysaux.257.736179685
input datafile file number=00005 name=+DATA/azardb/datafile/example.269.736179971
input datafile file number=00003 name=+DATA/azardb/datafile/undotbs1.258.736179685
input datafile file number=00004 name=+SPTEST/azardb/datafile/users.256.737964169
channel d1: starting piece 1 at 17-DEC-10
channel d1: finished piece 1 at 17-DEC-10
piece handle=/backups/df_t737969795_s6_p1 tag=TAG20101217T073635 comment=NONE
channel d1: backup set complete, elapsed time: 00:02:27
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 17-DEC-10
channel d1: finished piece 1 at 17-DEC-10
piece handle=/backups/df_t737969943_s7_p1 tag=TAG20101217T073635 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-DEC-10

sql statement: alter system archive log current

Starting backup at 17-DEC-10
current log archived
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=1 STAMP=736268182
input archived log thread=1 sequence=4 RECID=2 STAMP=736345263
input archived log thread=1 sequence=5 RECID=3 STAMP=736438711
input archived log thread=1 sequence=6 RECID=4 STAMP=737551583
input archived log thread=1 sequence=7 RECID=5 STAMP=737880523
input archived log thread=1 sequence=8 RECID=6 STAMP=737897929
input archived log thread=1 sequence=9 RECID=7 STAMP=737962069
input archived log thread=1 sequence=10 RECID=8 STAMP=737969217
input archived log thread=1 sequence=11 RECID=9 STAMP=737969220
input archived log thread=1 sequence=12 RECID=10 STAMP=737969948
input archived log thread=1 sequence=13 RECID=11 STAMP=737969948
channel d1: starting piece 1 at 17-DEC-10
channel d1: finished piece 1 at 17-DEC-10
piece handle=/backups/al_t737969948_s8_p1 tag=TAG20101217T073908 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
Finished backup at 17-DEC-10

released channel: d1

RMAN>

Step 3: Create pfile & edit some required parameters

SQL> create pfile='/backups/initAUX.ora' from spfile;

File created.

SQL>

Edit& Save

*.audit_file_dest =/u01/app/oracle/AUX/adump
*.core_dump_dest =/u01/app/oracle/AUX/cdump
*.db_name ="AUX"
*.instance_name =AUX
*.control_files =/u01/app/oracle/AUX/control01.ctl
*.db_file_name_convert =("+DATA","/u01/app/oracle/AUX","+SPTEST","/u01/app/oracle/AUX")
*.log_file_name_convert =("+DATA","/u01/app/oracle/AUX")
*.undo_management =AUTO
*.undo_retention =10800
*.undo_tablespace='UNDOTBS1'
*.db_block_size=8192
*.compatible='11.2.0.0.0'

Step 4: startup nomount for AUX database

[oracle@localhost ~]$ export ORACLE_SID=AUX
[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 17 09:14:09 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup nomount pfile='/backups/initAUX.ora';
ORACLE instance started.

Total System Global Area  146472960 bytes
Fixed Size                  1335080 bytes
Variable Size              92274904 bytes
Database Buffers           50331648 bytes
Redo Buffers                2531328 bytes
SQL>

Step 5:Create duplicate database from here

[oracle@localhost ~]$ export ORACLE_SID=AUX
[oracle@localhost ~]$ rman target sys/Admin123@azardb auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 17 09:18:34 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: AZARDB (DBID=1655311948)
connected to auxiliary database: AUX (not mounted)

RMAN> run{
2> allocate auxiliary channel C1 device type disk;
3> duplicate target database to AUX;
4> }

using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=20 device type=DISK

Starting Duplicate Db at 17-DEC-10

contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK

contents of Memory Script:
{
sql clone "alter system set  db_name =
''AZARDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set  db_unique_name =
''AUX'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''AZARDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''AUX'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK

Starting restore at 17-DEC-10

channel C1: starting datafile backup set restore
channel C1: restoring control file
channel C1: reading from backup piece /backups/df_t737969943_s7_p1
channel C1: piece handle=/backups/df_t737969943_s7_p1 tag=TAG20101217T073635
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/AUX/control01.ctl
Finished restore at 17-DEC-10

database mounted

contents of Memory Script:
{
set until scn  971599;
set newname for datafile  1 to
"/u01/app/oracle/AUX/azardb/datafile/system.256.736179685";
set newname for datafile  2 to
"/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685";
set newname for datafile  3 to
"/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685";
set newname for datafile  4 to
"/u01/app/oracle/AUX/azardb/datafile/users.256.737964169";
set newname for datafile  5 to
"/u01/app/oracle/AUX/azardb/datafile/example.269.736179971";
restore
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 17-DEC-10

channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00001 to /u01/app/oracle/AUX/azardb/datafile/system.256.736179685
channel C1: restoring datafile 00002 to /u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
channel C1: restoring datafile 00003 to /u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
channel C1: restoring datafile 00004 to /u01/app/oracle/AUX/azardb/datafile/users.256.737964169
channel C1: restoring datafile 00005 to /u01/app/oracle/AUX/azardb/datafile/example.269.736179971
channel C1: reading from backup piece /backups/df_t737969795_s6_p1
channel C1: piece handle=/backups/df_t737969795_s6_p1 tag=TAG20101217T073635
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:01:27
Finished restore at 17-DEC-10

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/system.256.736179685
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/users.256.737964169
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/example.269.736179971

contents of Memory Script:
{
set until scn  971599;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 17-DEC-10

starting media recovery

archived log for thread 1 with sequence 12 is already on disk as file +DATA/azardb/archivelog/2010_12_17/thread_1_seq_12.279.737969947
archived log for thread 1 with sequence 13 is already on disk as file +DATA/azardb/archivelog/2010_12_17/thread_1_seq_13.280.737969949
archived log file name=+DATA/azardb/archivelog/2010_12_17/thread_1_seq_12.279.737969947 thread=1 sequence=12
archived log file name=+DATA/azardb/archivelog/2010_12_17/thread_1_seq_13.280.737969949 thread=1 sequence=13
media recovery complete, elapsed time: 00:00:00
Finished recover at 17-DEC-10

contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set  db_name =
''AUX'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset  db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK

sql statement: alter system set  db_name =  ''AUX'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX" RESETLOGS ARCHIVELOG
MAXLOGFILES     16
MAXLOGMEMBERS      3
MAXDATAFILES      100
MAXINSTANCES     8
MAXLOGHISTORY      292
LOGFILE
GROUP  1 ( '/u01/app/oracle/AUX/azardb/onlinelog/group_1.262.736179919', '/u01/app/oracle/AUX/azardb/onlinelog/group_1.263.736179919' ) SIZE 50 M  REUSE,
GROUP  2 ( '/u01/app/oracle/AUX/azardb/onlinelog/group_2.264.736179921', '/u01/app/oracle/AUX/azardb/onlinelog/group_2.265.736179925' ) SIZE 50 M  REUSE,
GROUP  3 ( '/u01/app/oracle/AUX/azardb/onlinelog/group_3.266.736179927', '/u01/app/oracle/AUX/azardb/onlinelog/group_3.267.736179929' ) SIZE 50 M  REUSE
DATAFILE
'/u01/app/oracle/AUX/azardb/datafile/system.256.736179685'
CHARACTER SET WE8MSWIN1252

contents of Memory Script:
{
set newname for tempfile  1 to
"/u01/app/oracle/AUX/azardb/tempfile/temp.268.736179955";
switch clone tempfile all;
catalog clone datafilecopy  "/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685",
"/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685",
"/u01/app/oracle/AUX/azardb/datafile/users.256.737964169",
"/u01/app/oracle/AUX/azardb/datafile/example.269.736179971";
switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/AUX/azardb/tempfile/temp.268.736179955 in control file

cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685 RECID=1 STAMP=737976112
cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685 RECID=2 STAMP=737976112
cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/users.256.737964169 RECID=3 STAMP=737976112
cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/example.269.736179971 RECID=4 STAMP=737976113

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=737976112 file name=/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=737976112 file name=/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=737976112 file name=/u01/app/oracle/AUX/azardb/datafile/users.256.737964169
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=737976113 file name=/u01/app/oracle/AUX/azardb/datafile/example.269.736179971

[oracle@localhost ~]$ export ORACLE_SID=AUX
[oracle@localhost ~]$ rman target sys/Admin123@azardb auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 17 09:18:34 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: AZARDB (DBID=1655311948)
connected to auxiliary database: AUX (not mounted)

RMAN> run{
2> allocate auxiliary channel C1 device type disk;
3> duplicate target database to AUX;
4> }

using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=20 device type=DISK

Starting Duplicate Db at 17-DEC-10

contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK

contents of Memory Script:
{
sql clone "alter system set  db_name =
''AZARDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set  db_unique_name =
''AUX'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''AZARDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''AUX'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK

Starting restore at 17-DEC-10

channel C1: starting datafile backup set restore
channel C1: restoring control file
channel C1: reading from backup piece /backups/df_t737969943_s7_p1
channel C1: piece handle=/backups/df_t737969943_s7_p1 tag=TAG20101217T073635
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/AUX/control01.ctl
Finished restore at 17-DEC-10

database mounted

contents of Memory Script:
{
set until scn  971599;
set newname for datafile  1 to
"/u01/app/oracle/AUX/azardb/datafile/system.256.736179685";
set newname for datafile  2 to
"/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685";
set newname for datafile  3 to
"/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685";
set newname for datafile  4 to
"/u01/app/oracle/AUX/azardb/datafile/users.256.737964169";
set newname for datafile  5 to
"/u01/app/oracle/AUX/azardb/datafile/example.269.736179971";
restore
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 17-DEC-10

channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00001 to /u01/app/oracle/AUX/azardb/datafile/system.256.736179685
channel C1: restoring datafile 00002 to /u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
channel C1: restoring datafile 00003 to /u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
channel C1: restoring datafile 00004 to /u01/app/oracle/AUX/azardb/datafile/users.256.737964169
channel C1: restoring datafile 00005 to /u01/app/oracle/AUX/azardb/datafile/example.269.736179971
channel C1: reading from backup piece /backups/df_t737969795_s6_p1
channel C1: piece handle=/backups/df_t737969795_s6_p1 tag=TAG20101217T073635
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:01:27
Finished restore at 17-DEC-10

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/system.256.736179685
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/users.256.737964169
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=737976075 file name=/u01/app/oracle/AUX/azardb/datafile/example.269.736179971

contents of Memory Script:
{
set until scn  971599;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 17-DEC-10

starting media recovery

archived log for thread 1 with sequence 12 is already on disk as file +DATA/azardb/archivelog/2010_12_17/thread_1_seq_12.279.737969947
archived log for thread 1 with sequence 13 is already on disk as file +DATA/azardb/archivelog/2010_12_17/thread_1_seq_13.280.737969949
archived log file name=+DATA/azardb/archivelog/2010_12_17/thread_1_seq_12.279.737969947 thread=1 sequence=12
archived log file name=+DATA/azardb/archivelog/2010_12_17/thread_1_seq_13.280.737969949 thread=1 sequence=13
media recovery complete, elapsed time: 00:00:00
Finished recover at 17-DEC-10

contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set  db_name =
''AUX'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset  db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK

sql statement: alter system set  db_name =  ''AUX'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     146472960 bytes

Fixed Size                     1335080 bytes
Variable Size                 92274904 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2531328 bytes
allocated channel: C1
channel C1: SID=18 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "AUX" RESETLOGS ARCHIVELOG
MAXLOGFILES     16
MAXLOGMEMBERS      3
MAXDATAFILES      100
MAXINSTANCES     8
MAXLOGHISTORY      292
LOGFILE
GROUP  1 ( '/u01/app/oracle/AUX/azardb/onlinelog/group_1.262.736179919', '/u01/app/oracle/AUX/azardb/onlinelog/group_1.263.736179919' ) SIZE 50 M  REUSE,
GROUP  2 ( '/u01/app/oracle/AUX/azardb/onlinelog/group_2.264.736179921', '/u01/app/oracle/AUX/azardb/onlinelog/group_2.265.736179925' ) SIZE 50 M  REUSE,
GROUP  3 ( '/u01/app/oracle/AUX/azardb/onlinelog/group_3.266.736179927', '/u01/app/oracle/AUX/azardb/onlinelog/group_3.267.736179929' ) SIZE 50 M  REUSE
DATAFILE
'/u01/app/oracle/AUX/azardb/datafile/system.256.736179685'
CHARACTER SET WE8MSWIN1252

contents of Memory Script:
{
set newname for tempfile  1 to
"/u01/app/oracle/AUX/azardb/tempfile/temp.268.736179955";
switch clone tempfile all;
catalog clone datafilecopy  "/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685",
"/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685",
"/u01/app/oracle/AUX/azardb/datafile/users.256.737964169",
"/u01/app/oracle/AUX/azardb/datafile/example.269.736179971";
switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/AUX/azardb/tempfile/temp.268.736179955 in control file

cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685 RECID=1 STAMP=737976112
cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685 RECID=2 STAMP=737976112
cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/users.256.737964169 RECID=3 STAMP=737976112
cataloged datafile copy
datafile copy file name=/u01/app/oracle/AUX/azardb/datafile/example.269.736179971 RECID=4 STAMP=737976113

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=737976112 file name=/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=737976112 file name=/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=737976112 file name=/u01/app/oracle/AUX/azardb/datafile/users.256.737964169
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=737976113 file name=/u01/app/oracle/AUX/azardb/datafile/example.269.736179971

contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script

database opened

Duplicate database was successfully created

Step 6: Check Duplicate Database

[oracle@localhost ~]$ export ORACLE_SID=AUX
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 17 09:25:45 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter user-name: / as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$database;

NAME
---------
AUX

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/AUX/azardb/datafile/system.256.736179685
/u01/app/oracle/AUX/azardb/datafile/sysaux.257.736179685
/u01/app/oracle/AUX/azardb/datafile/undotbs1.258.736179685
/u01/app/oracle/AUX/azardb/datafile/users.256.737964169
/u01/app/oracle/AUX/azardb/datafile/example.269.736179971

SQL>

Possible Errors:

You can get some errors , cann’t restore datafile & onlineredo log files, in this case you need to create directory ,It should be indicate.

azardb/datafile

azardb/onlinelog

How to move a datafile from file system to ASM Diskgroup

Condition ,

If you want to move SYSTEM & UNDO tablespace, DB stage is mounted.

If you want to other tablespace datafiles , Tablespace should be OFFLINE

Step 1:

Check datafile & ASM diskgroup size

SQL> select name from v$datafile where file#='4';

NAME

--------------------------------------------------
/datafile/users.dbf

SQL> select file#, name, (bytes/1048576) File_Size_MB from v$datafile where file#='4';

FILE#         NAME       FILE_SIZE_MB
------------
4       /datafile/users.dbf   5

ASM diskgroup size

SQL> select NAME, STATE, TOTAL_MB, FREE_MB from v$asm_diskgroup;

NAME                           STATE         TOTAL_MB    FREE_MB
------------------------------ ----------- ---------- ----------
DATA                           MOUNTED          20472      18657
SPTEST                         MOUNTED          10228      10167

SQL>

Step 2: Tablespace offline


SQL> alter tablespace users offline;

Tablespace altered.

Step 3: Here i just moved Users tablespace datafile to ‘+SPTEST’ diskgroup.

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 17 06:01:40 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: AZARDB (DBID=1655311948)

RMAN> copy datafile 4 to '+SPTEST';

Starting backup at 17-DEC-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=54 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/datafile/users.dbf
output file name=+SPTEST/azardb/datafile/users.256.737964169 tag=TAG20101217T060246 RECID=3 STAMP=737964171
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 17-DEC-10

Step 4 : Updataing the controlfile


RMAN> switch datafile 4 to copy;

datafile 4 switched to datafile copy "+SPTEST/azardb/datafile/users.256.737964169"

Step 5:

Check datafile location SQL> select name from v$datafile where file#=4;

NAME
--------------------------------------------------
+SPTEST/azardb/datafile/users.256.737964169

Now its moved for Diskgroup.

Tablespace online

SQL> alter tablespace users online;

Tablespace altered.

SQL>

 

Metalink Note [ID 390274.1]

How to move a datafile from ASM to file system

 

Here i show you How to move a datafile from ASM to file system using RMAN.

Condition ,

If you want to move SYSTEM & UNDO tablespace, DB stage is mounted.

If you want to other tablespace datafiles , Tablespace should be OFFLINE

Step 1:

Check your datafile size and also check your filesystem size also where you want to store (df -k)

Here I’m go to move users tablespace datafile.


SQL>select file#, name, (bytes/1048576) File_Size_MB from v$datafile where name ='+DATA/azardb/datafile/users.259.736179687';
FILE#              NAME FILE_                               SIZE_MB
4  +DATA/azardb/datafile/users.259.736179687    5

Step 2: Tablespace Offline


SQL> alter tablespace users offline;

Tablespace altered.

Step 3:


[oracle@localhost ~]$ export ORACLE_SID=azardb
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Dec 16 16:02:23 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: AZARDB (DBID=1655311948)

RMAN> copy datafile 4 to '/datafile/users.dbf';

Starting backup at 16-DEC-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/azardb/datafile/users.259.736179687
output file name=/datafile/users.dbf tag=TAG20101216T160332 RECID=2 STAMP=737913816
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04
Finished backup at 16-DEC-10

RMAN>

Step 4:

update the control file  with new location of the datafile.


SQL> alter database rename file '+DATA/azardb/datafile/users.259.736179687' to '/datafile/users.dbf';

Database altered.

Step 5: Tablespace online

SQL> alter tablespace users online;

Tablespace altered.

Step 6:

Check your new datafile location


SQL> select name from v$datafile;

NAME
----------------------------------------------------------------------------------------------------
+DATA/azardb/datafile/system.256.736179685
+DATA/azardb/datafile/sysaux.257.736179685
+DATA/azardb/datafile/undotbs1.258.736179685
/datafile/users.dbf
+DATA/azardb/datafile/example.269.736179971

SQL>

How to copy a datafile from ASM to filesystem without using RMAN

Here I just show you How to copy a datafile from ASM to file system without  using RMAN

Step 1:


SQL> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
+DATA/azardb/datafile/system.256.736179685
+DATA/azardb/datafile/sysaux.257.736179685
+DATA/azardb/datafile/undotbs1.258.736179685
+DATA/azardb/datafile/users.259.736179687
+DATA/azardb/datafile/example.269.736179971

Here I copy users datafile from asm to file system

Step 2:

create a directory


[root@localhost ~]# mkdir /datafile
[root@localhost ~]# chown -R oracle:dba /datafile
[root@localhost ~]# ls -ld /datafile
drwxr-xr-x 2 oracle dba 4096 Dec 16 15:28 /datafile

Step 3:

Crreate Directory for where your datafile avilable in ASM


SQL> create or replace directory SOURCE_DATA as '+DATA/azardb/datafile/';

Directory created.

Step 4:

Create new directory for where you want store copied datafile


SQL> create or replace directory DEST_DATA as '/datafile/';

Directory created.

Step 5:

Execute below

SQL> BEGIN
dbms_file_transfer.copy_file(source_directory_object =>
'SOURCE_DATA', source_file_name => 'users.259.736179687',
destination_directory_object => 'DEST_DATA',
destination_file_name => 'users01.dbf');
END;
/
PL/SQL procedure successfully completed.

Step 6:

NOw i just checked in /datafile directory whether its copied or not


[root@localhost ~]# cd /datafile
[root@localhost datafile]# ls
users01.dbf

Now its okay.

Metalink Note [ID 428893.1]

How to move ASM spfile from one diskgroup to another diskgroup

Here , I just showed you ,How to move ASM spfile from one diskgroup to another diskgroup.

before I have currently using one diskgroup, so i need to create another diskgroup using ASMCA, I just formated disk using fdisk command.

After created new diskgroup, follow the steps


[root@localhost ~]# su - oracle
[oracle@localhost ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
[oracle@localhost ~]$ export PATH=/u01/app/oracle/product/11.2.0/grid/bin
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 16 11:46:32 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter user-name: sys/Admin123 as sysasm

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/asm/asmparameterfile/reg
istry.253.736177541
SQL> create pfile='/install/initASM.ora' from spfile;

File created.

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/asm/asmparameterfile/reg
istry.253.736177541
SQL> create spfile='+SPTEST' from pfile='/install/initASM.ora';

File created.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option
[oracle@localhost ~]$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'localhost'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'localhost'
CRS-2673: Attempting to stop 'ora.SPTEST.dg' on 'localhost'
CRS-2673: Attempting to stop 'ora.azardb.db' on 'localhost'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'localhost' succeeded
CRS-2677: Stop of 'ora.SPTEST.dg' on 'localhost' succeeded
CRS-2677: Stop of 'ora.azardb.db' on 'localhost' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'localhost'
CRS-2677: Stop of 'ora.DATA.dg' on 'localhost' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'localhost'
CRS-2677: Stop of 'ora.asm' on 'localhost' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'localhost'
CRS-2677: Stop of 'ora.cssd' on 'localhost' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'localhost'
CRS-2677: Stop of 'ora.diskmon' on 'localhost' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'localhost' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[oracle@localhost ~]$

[oracle@localhost ~]$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[oracle@localhost ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
[oracle@localhost ~]$ export PATH=/u01/app/oracle/product/11.2.0/grid/bin
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 16 11:57:30 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter user-name: sys/Admin123 as sysasm

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +SPTEST/asm/asmparameterfile/r
egistry.253.737898615
SQL> select name,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
SPTEST                         MOUNTED
DATA                           MOUNTED

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

you can verify using asmcmd command

[oracle@localhost ~]$ asmcmd spget
+SPTEST/asm/asmparameterfile/registry.253.737898615

just remove old spfile from here

[[oracle@localhost ~]$ asmcmd rm +DATA/asm/asmparameterfile/registry.253.736177541

[oracle@localhost ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
[oracle@localhost ~]$ export PATH=/u01/app/oracle/product/11.2.0/grid/bin
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 16 12:00:08 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter user-name: sys/Admin123 as sysasm

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +SPTEST/asm/asmparameterfile/r
egistry.253.737898615
SQL>

Metalink Note [ID 1082943.1].

Datapump REUSE_DUMPFILES parameter

REUSE_DUMPFILES parameter is using for overwriting preexisting dump file.

It  default parameter is NO.

Data Pump Export will return an error if you specify a dump file name that already exists. The REUSE_DUMPFILES parameter allows you to override that behavior and reuse a dump file name.

This is compatabile for Oracle 11g Version, Not in Oracle 10g version.

see below Example :


C:\Users\mazar>expdp scott/tiger@azardb dumpfile=reusedump.dmp directory=data_pump_dir

Export: Release 11.2.0.1.0 - Production on Sat Dec 11 12:17:12 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/********@azardb dumpfile=reusedump.dmp directory=data_pump_dir
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 256 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT"                              5.945 KB       4 rows
. . exported "SCOTT"."EMP"                               8.578 KB      14 rows
. . exported "SCOTT"."MYTEST"                            5.429 KB       1 rows
. . exported "SCOTT"."SALGRADE"                          5.875 KB       5 rows
. . exported "SCOTT"."BONUS"                                 0 KB       0 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
  C:\APP\ORACLE\MAZAR\ADMIN\AZARDB\DPDUMP\REUSEDUMP.DMP
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 12:18:05
C:\Users\mazar>expdp scott/tiger@azardb dumpfile=reusedump.dmp directory=data_pump_dir

Export: Release 11.2.0.1.0 - Production on Sat Dec 11 12:18:17 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31641: unable to create dump file "C:\app\oracle\mazar\admin\azardb\dpdump\reusedump.dmp"
ORA-27038: created file already exists
OSD-04010: <create> option specified, file already exists

 



C:\Users\mazar>expdp scott/tiger@azardb dumpfile=reusedump.dmp directory=data_pump_dir reuse_dumpfiles=y

Export: Release 11.2.0.1.0 - Production on Sat Dec 11 12:18:31 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/********@azardb dumpfile=reusedump.dmp directory=data_pump_dir reuse_dumpfiles=y
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 256 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT"                              5.945 KB       4 rows
. . exported "SCOTT"."EMP"                               8.578 KB      14 rows
. . exported "SCOTT"."MYTEST"                            5.429 KB       1 rows
. . exported "SCOTT"."SALGRADE"                          5.875 KB       5 rows
. . exported "SCOTT"."BONUS"                                 0 KB       0 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
  C:\APP\ORACLE\MAZAR\ADMIN\AZARDB\DPDUMP\REUSEDUMP.DMP
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 12:19:10

Ref :

http://download.oracle.com/docs/cd/E11882_01/server.112/e16536/dp_export.htm