Posted in 2016

Compression of dumpfile

I don’t see it as very useful, because someone who does not know about licensing can fall into this pond. Normal datapump with later gzip would do the same compression as I see and basic compression (without licencing ACO I think) does it pretty the same.. well simple data compress nearly the same.. so if you have basic datatypes in your schema, you can reduce the size of the dumpfile by 1/3.

[oracle@hackbook ~]$ expdp system schemas=jano dumpfile=backup.dmp compression=all compression_algorithm=high

Export: Release 12.1.0.2.0 - Production on Fri Jul 8 10:18:20 2016

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

UDE-01017: operation generated ORACLE error 1017
ORA-01017: invalid username/password; logon denied

Username: system 
Password: 

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** schemas=jano dumpfile=backup.dmp compression=all compression_algorithm=high 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 80 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "JANO"."TEST"                               24.30 MB   10000 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/rCAT/dpdump/backup.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Jul 8 10:19:27 2016 elapsed 0 00:00:35

[oracle@hackbook ~]$ ls -l /u01/app/oracle/admin/rCAT/dpdump/backup.dmp
-rw-r-----. 1 oracle dba 25542656 Jul  8 10:19 /u01/app/oracle/admin/rCAT/dpdump/backup.dmp
[oracle@hackbook ~]$ expdp system schemas=jano dumpfile=backup1.dmp 

Export: Release 12.1.0.2.0 - Production on Fri Jul 8 10:20:00 2016

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

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** schemas=jano dumpfile=backup1.dmp 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 80 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "JANO"."TEST"                               38.25 MB   10000 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/rCAT/dpdump/backup1.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Jul 8 10:20:32 2016 elapsed 0 00:00:25

[oracle@hackbook ~]$ 
[oracle@hackbook ~]$ gzip /u01/app/oracle/admin/rCAT/dpdump/backup1.dmp
[oracle@hackbook ~]$ ls -l /u01/app/oracle/admin/rCAT/dpdump/backup1.dmp.gz 
-rw-r-----. 1 oracle dba 25502770 Jul  8 10:20 /u01/app/oracle/admin/rCAT/dpdump/backup1.dmp.gz
[oracle@hackbook ~]$ expdp system schemas=jano dumpfile=backup.dmp compression=all compression_algorithm=basic

Export: Release 12.1.0.2.0 - Production on Fri Jul 8 10:27:44 2016

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

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** schemas=jano dumpfile=backup.dmp compression=all compression_algorithm=basic 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 80 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "JANO"."TEST"                               22.87 MB   10000 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/rCAT/dpdump/backup.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Jul 8 10:28:20 2016 elapsed 0 00:00:32

[oracle@hackbook ~]$ ls -l /u01/app/oracle/admin/rCAT/dpdump/backup.dmp
-rw-r-----. 1 oracle dba 24051712 Jul  8 10:28 /u01/app/oracle/admin/rCAT/dpdump/backup.dmp
Advertisements

Comparing OCP 11g with Upgrade…

Comparing OCP 11g with Upgrade to OCP 12c. Hm, I think that OCP 12c Upgrade exam is like a walk through hell. 11g was simple, little bit of backup, scheduler and internationalization as I can remember, but now, it’s soooooo much 😮

I don’t understand why someone…

I don’t understand why someone makes cold/hot backups if we can do normal backups with rman, the copy path is for me irritating. Once I can stop a database, I can mount it and backup as compressed backupset database it, if it’s a noarchivelog database. If I cannot stop a noarchivelog database, I cannot anyway do a hot backup. So either way if it’s in noarchivelog mode it has no sense to do it with os commands.

If it’s in archivelog mode, I can use again rman. Playing with hot backups and recreating controlfiles and other problems you find at restoring this database is not worth the time.

Posted in 2016

Migrating a Tablespace with CONVERT and Transportable tablespace

  1. First you have to set the tablespace to read only.
[oracle@hackbook ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Jul 7 08:58:09 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.
 Connected to:
 Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
 With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> alter session set container=rcat ;

Session altered.

SQL> alter tablespace corruption read only ;

Database altered.
  1. convert the tablespace to new platform
[oracle@hackbook ~]$ rman target sys/oracle@rcat

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Jul 7 09:00:48 2016

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

connected to target database: CCLOUD1 (DBID=1191441626)

RMAN> convert tablespace "CORRUPTION" to platform 'Linux IA (64-bit)' format '/tmp/%U' ;

Starting conversion at source at 07-JUL-16
 using target database control file instead of recovery catalog
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: SID=46 device type=DISK
 channel ORA_DISK_1: starting datafile conversion
 input datafile file number=00010 name=/u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_corrupti_cqnms1yb_.dbf
 converted datafile=/tmp/data_D-CCLOUD1_I-1191441626_TS-CORRUPTION_FNO-10_0hra39o8
 channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:02
 Finished conversion at source at 07-JUL-16

RMAN>

Recovery Manager complete.
  1. export the tablespace, here I had some troubles because I didn’t know PDBs need to have their own directories, an answer from Franck Pachot in the community helped.
[oracle@hackbook log]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Jul 7 09:24:25 2016

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> alter session set container=rcat ;

Session altered.

SQL> create directory backup_dir as '/u01/backup' ;

Directory created.

[oracle@hackbook log]$ expdp dumpfile=save.dmp transport_tablespaces=corruption directory=backup_dir

Export: Release 12.1.0.2.0 - Production on Thu Jul 7 09:25:02 2016

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

Username: system/oracle@rcat

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01": system/********@rcat dumpfile=save.dmp transport_tablespaces=corruption directory=backup_dir 
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
 /u01/backup/save.dmp
******************************************************************************
Datafiles required for transportable tablespace CORRUPTION:
 /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_corrupti_cqnms1yb_.dbf
Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at Thu Jul 7 09:28:33 2016 elapsed 0 00:03:20
  1. Transfer and import the datafile and dumpfile to your new destination database, the users in the tablespaces have to exist or use REMAP schema if they don’t you can remap them to existing schemas. As I do not have any different platform, I end this blog post only theoretically.
impdp system/oracle@rcatIA parfile=import.par

Contents of import.par:

dumpfile=save.dmp

directory=backup_dir

transport_datafiles='/new/path/o_corruption.dbf'

logfile=import.log

 

Posted in Forgotten themes

Duplicating a CDB with PDB to different host

  1. on the source create a static listener and create tnsnames entries
[oracle@test admin]$ cat listener.ora
# listener.ora Network Configuration
File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER_RCLOUD =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.254)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER_RCLOUD =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = rCLOUD)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
      (SID_NAME = rCLOUD)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.254)(PORT = 51521))
    )
  )

[oracle@test admin]$
[oracle@test admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration
File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

RCAT =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = test.example.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = rCAT)
    )
  )
rCLOUD=(DESCRIPTION=(CONNECT_DATA=(SID=rcloud))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.254)(PORT=1521)))
rCLOUD_dup=(DESCRIPTION=(CONNECT_DATA=(SID=rcloud))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.253)(PORT=1521)))

LISTENER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.254)(PORT=51521)))
LISTENER_RCLOUD=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.254)(PORT=1521)))

2. I register my local listeners (it’s new for me, we had always static listeners in the old work, but now I am more cool.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show parameter listener

NAME				     TYPE	 VALUE
------------------------------------ -----------
------------------------------
listener_networks		     string
local_listener			     string	 LISTENER, LISTENER_RCLOUD
remote_listener 		     string
SQL> 
  1. on the target host install a new oracle home…
  2. create an oratab entry
[oracle@test-r1 dbs]$ cat /etc/oratab
rCLOUD:/u01/app/oracle/product/12.1.0/dbhome_1:N

5. create a password file

cd $ORACLE_HOME/dbs
orapwd file=orapwrCLOUD

6. create an initrCLOUD.ora – I stringsed the spfile on the source database and copied the text simply, changed the control_files parameter and created audit_file_dest

[oracle@test-r1 dbs]$ mkdir -p /u01/app/oracle/admin/rCLOUD/adump
[oracle@test-r1 dbs]$ cat initrCLOUD.ora
*.audit_file_dest='/u01/app/oracle/admin/rCLOUD/adump'
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.control_files='/u01/app/oracle/oradata/RCLOUD/controlfile/control1.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_name='rCLOUD'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4815m
*.db_securefile='PREFERRED'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=rCLOUDXDB)'
*.enable_pluggable_database=true
*.open_cursors=300
*.pga_aggregate_target=100m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=400m
*.undo_tablespace='UNDOTBS1'

7. static listener for the rCLOUD duplicate and of course the tnsnames entries, I will not write it again.

LISTENER_RCLOUD =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.253)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER_RCLOUD =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = rCLOUD)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
      (SID_NAME = rCLOUD)
    )
  )
  1. Start the duplicate
[oracle@test-r1 dbs]$ rman target sys/oracle@rcloud auxiliary sys/oracle@rcloud_dup

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jul 6 10:13:00
2016

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

connected to target database: RCLOUD (DBID=3718501809)
connected to auxiliary database: RCLOUD (not started)

RMAN> startup clone nomount

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes

RMAN> duplicate target database to rCLOUD from active database using
compressed backupset ;

Starting Duplicate Db at 06-JUL-16
using target database control file instead of recovery catalog allocated channel:
ORA_AUX_DISK_1 channel
ORA_AUX_DISK_1: SID=22 device type=DISK current log archived

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

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes

Starting restore at 06-JUL-16
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=22 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: restoring control file
dbms_backup_restore.restoreCancel() failed Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes

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

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

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/06/2016 10:14:11
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-19660: some files in the backup set could not be verified
ORA-19661: datafile 0 could not be verified
ORA-19849: error while reading backup piece from service rcloud
ORA-19504: failed to create file
"/u01/app/oracle/oradata/RCLOUD/controlfile/control1.ctl"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory Additional information: 1

RMAN> 

Recovery Manager complete.

9. Fix the problems simply with creating all directories that you have defined in the initrCLOUD.ora

[oracle@test-r1 dbs]$ mkdir -p /u01/app/oracle/oradata/RCLOUD/controlfile/
[oracle@test-r1 dbs]$ rman target sys/oracle@rcloud auxiliary sys/oracle@rcloud_dup

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jul 6 10:14:41
2016

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

connected to target database: RCLOUD (DBID=3718501809) connected to auxiliary database (not started)

RMAN> startup clone nomount ;

Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes

RMAN> duplicate target database to rCLOUD from active database using
compressed backupset ;

Starting Duplicate Db at 06-JUL-16
using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel
ORA_AUX_DISK_1: SID=22 device type=DISK current log archived

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

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes

Starting restore at 06-JUL-16
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=22 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network
 backup set from service rcloud channel
ORA_AUX_DISK_1: restoring control file channel
ORA_AUX_DISK_1: restore
complete, elapsed time: 00:00:01 output file name=/u01/app/oracle/oradata/RCLOUD/controlfile/control1.ctl
Finished restore at 06-JUL-16

database mounted

contents of Memory Script:
{
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  6 to new;
   set newname for clone datafile  17 to new;
   set newname for clone datafile  18 to new;
   set newname for clone datafile  19 to new;
   restore
   from service  'rcloud'   using compressed backupset
   clone database
   ;
   sql 'alter system archive log current'; } executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 06-JUL-16
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_undotbs1_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00017 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00018 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25 channel
ORA_AUX_DISK_1: starting datafile backup set restore channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel
ORA_AUX_DISK_1: restoring datafile 00019 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_%u_.dbf
channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 06-JUL-16

sql statement: alter system archive log current current log archived

contents of Memory Script:
{
   restore clone force from service  'rcloud' using compressed backupset
   archivelog from scn  1115044;
   switch clone datafile all;
}
executing Memory Script

Starting restore at 06-JUL-16
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to default destination channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=58 channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 channel
ORA_AUX_DISK_1: starting archived log restore to default destination channel
ORA_AUX_DISK_1: using compressed network backup set from service rcloud channel
ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=59 channel
ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 06-JUL-16

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_cqshk7ct_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_cqshkplg_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshky20_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshldy5_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_undotbs1_cqshlvxh_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshlyqc_.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=16 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_cqshm08g_.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=17 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshm7ts_.dbf
datafile 19 switched to datafile copy
input datafile copy RECID=18 STAMP=916481827 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshmzy1_.dbf

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

executing command: SET until clause

Starting recover at 06-JUL-16
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 58
is already on disk as file /u01/app/oracle/fast_recovery_area/RCLOUD/archivelog/2016_07_06/o1_mf_1_58_cqshn1dn_.arc
archived log for thread 1 with sequence 59
 is already on disk as file /u01/app/oracle/fast_recovery_area/RCLOUD/archivelog/2016_07_06/o1_mf_1_59_cqshn2g2_.arc
archived log file
name=/u01/app/oracle/fast_recovery_area/RCLOUD/archivelog/2016_07_06/o1_mf_1_58_cqshn1dn_.arc
thread=1 sequence=58 archived log file name=/u01/app/oracle/fast_recovery_area/RCLOUD/archivelog/2016_07_06/o1_mf_1_59_cqshn2g2_.arc
thread=1 sequence=59
media recovery complete, elapsed time: 00:00:00
Finished recover at 06-JUL-16
Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes

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

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

sql statement: alter system reset  db_unique_name scope=spfile Oracle instance started

Total System Global Area     419430400 bytes

Fixed Size                     2925120 bytes
Variable Size                264244672 bytes
Database Buffers             146800640 bytes
Redo Buffers                   5459968 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "RCLOUD" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1  SIZE 50 M ,
  GROUP   2  SIZE 50 M ,
  GROUP   3  SIZE 50 M
 DATAFILE
  '/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_cqshk7ct_.dbf',
  '/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_cqshkplg_.dbf',
  '/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_system_cqshm08g_.dbf'
 CHARACTER SET AL32UTF8

contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   set newname for clone tempfile  2 to new;
   set newname for clone tempfile  3 to new;
   switch clone tempfile all;
   catalog clone datafilecopy
"/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshky20_.dbf",
 "/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshldy5_.dbf", 

"/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_undotbs1_cqshlvxh_.dbf",
 "/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshlyqc_.dbf",
 "/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshm7ts_.dbf",
 "/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshmzy1_.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 2 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_temp_%u_.tmp in control file
 renamed tempfile 3 to /u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_temp_%u_.tmp in control file

cataloged datafile copy
datafile copy file
name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshky20_.dbf
RECID=1 STAMP=916481845
cataloged datafile copy
datafile copy file
name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshldy5_.dbf
RECID=2 STAMP=916481845
cataloged datafile copy
datafile copy file
name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_undotbs1_cqshlvxh_.dbf RECID=3
STAMP=916481845 cataloged datafile copy datafile copy file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshlyqc_.dbf
RECID=4 STAMP=916481845
cataloged datafile copy
datafile copy file
name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshm7ts_.dbf
RECID=5 STAMP=916481845
cataloged datafile copy
datafile copy file
name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshmzy1_.dbf
RECID=6 STAMP=916481845

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=916481845 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshky20_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=916481845 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshldy5_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=3 STAMP=916481845 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_undotbs1_cqshlvxh_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=4 STAMP=916481845 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshlyqc_.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=5 STAMP=916481845 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_sysaux_cqshm7ts_.dbf
datafile 19 switched to datafile copy
input datafile copy RECID=6 STAMP=916481845 file name=/u01/app/oracle/oradata/RCLOUD/datafile/o1_mf_users_cqshmzy1_.dbf

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

database opened

contents of Memory Script:
{
   sql clone "alter pluggable database all open"; }
executing Memory Script

sql statement: alter pluggable database all open
Finished Duplicate Db at 06-JUL-16

3be10b9

Posted in Forgotten themes

Restoring a PDB causes problems

I am reading the documentation again and I don’t understand why I cannot restore a tablespace in a PDB

[oracle@hackbook ~]$ rman target sys@"(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=rcat))(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.2.15)(PORT=1521)))"

Recovery Manager: Release 12.1.0.2.0 - Production on Tue Jul 5 14:56:13 2016

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

target database Password: 
connected to target database: CCLOUD1 (DBID=1191441626, not open)

RMAN> report schema ;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name CLOUDDB1

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
7    260      SYSTEM               NO      /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_system_cqfldc9b_.dbf
8    605      SYSAUX               NO      /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_sysaux_cqfldcrv_.dbf
9    5        USERS                NO      /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_users_cqfljdqg_.dbf
10   10       CORRUPTION           NO      /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_corrupti_cqnms1yb_.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
3    20       TEMP                 32767       /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_temp_cqfldctf_.dbf

RMAN> restore tablespace CORRUPTION ;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "corruption": expecting one of: "root, double-quoted-string, identifier, single-quoted-string"
RMAN-01007: at line 1 column 20 file: standard input

RMAN> restore datafile 10 ;

Starting restore at 05-JUL-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oradata/CLOUDDB1/36994AC799462E62E0530F02000AFF86/datafile/o1_mf_corrupti_cqnms1yb_.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oradata/fra/CLOUDDB1/36994AC799462E62E0530F02000AFF86/backupset/2016_07_04/o1_mf_nnndf_TAG20160704T140801_cqnnh3n8_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oradata/fra/CLOUDDB1/36994AC799462E62E0530F02000AFF86/backupset/2016_07_04/o1_mf_nnndf_TAG20160704T140801_cqnnh3n8_.bkp tag=TAG20160704T140801
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 05-JUL-16

RMAN> recover datafile 10 ;

Starting recover at 05-JUL-16
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 171 is already on disk as file /u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_171_cqpyfdmo_.arc
archived log for thread 1 with sequence 172 is already on disk as file /u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_172_cqpyfdcm_.arc
archived log for thread 1 with sequence 173 is already on disk as file /u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_173_cqpyfdk7_.arc
archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_1_cqq9x4j3_.arc
archived log file name=/u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_171_cqpyfdmo_.arc thread=1 sequence=171
archived log file name=/u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_172_cqpyfdcm_.arc thread=1 sequence=172
archived log file name=/u01/app/oradata/fra/CLOUDDB1/archivelog/2016_07_05/o1_mf_1_173_cqpyfdk7_.arc thread=1 sequence=173
media recovery complete, elapsed time: 00:00:01
Finished recover at 05-JUL-16

RMAN>