Tuesday 23 February 2021

create 12c physical standby database from active database using rman duplicate

=========================

primary

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u03

Oldest online log sequence     3

Next log sequence to archive   5

Current log sequence           5

SQL>


ALTER DATABASE FORCE LOGGING;


SQL> select member from v$logfile;


MEMBER

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

/u01/app/oracle/oradata/test/redo01a.log

/u01/app/oracle/oradata/test/redo01b.log

/u01/app/oracle/oradata/test/redo02a.log

/u01/app/oracle/oradata/test/redo02b.log

/u01/app/oracle/oradata/test/redo03a.log

/u01/app/oracle/oradata/test/redo03b.log


SQL> select group# from v$log;

    GROUP#

----------

         1

         2

         3

Database altered.


alter database add standby logfile group 4 '/u01/app/oracle/oradata/test/redo04b.log' size 300m;

alter database add standby logfile group 5 '/u01/app/oracle/oradata/test/redo05a.log' size 300m;

alter database add standby logfile group 6 '/u01/app/oracle/oradata/test/redo06a.log' size 300m;


if multiplexing you can use as below


alter database add standby logfile group 7 ('/u01/app/oracle/oradata/test/redo07a.log','/u01/app/oracle/oradata/test/redo07b.log') size 300m;

SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;


    GROUP#    THREAD#  SEQUENCE# ARC STATUS

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

         4          0          0 YES UNASSIGNED

         5          0          0 YES UNASSIGNED

         6          0          0 YES UNASSIGNED


ALTER SYSTEM SET db_unique_name='test' SCOPE=SPFILE;

ALTER SYSTEM SET log_archive_config='dg_config=(test,test_stand)' SCOPE=SPFILE;


ALTER SYSTEM SET log_archive_dest_1='location=/u01/app/archive valid_for=(all_logfiles,all_roles) db_unique_name=test' SCOPE=SPFILE;


ALTER SYSTEM SET log_archive_dest_2='service=test_stand async valid_for=(online_logfiles,primary_role) db_unique_name=test_stand' scope=spfile;


SQL> ALTER SYSTEM SET fal_server='test_stand' SCOPE=SPFILE;

System altered.

11gr2 no longer required for fal_client;

SQL> ALTER SYSTEM SET fal_client='test' SCOPE=SPFILE;

System altered.


SQL> ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=SPFILE;


system altered.

ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/test_stand','/u01/app/oracle/oradata/test' SCOPE=SPFILE;

System altered.

SQL> ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/test_stand','/u01/app/oracle/oradata/test' SCOPE=SPFILE; 

System altered.


[oracle@PRD01 dbs]$ scp orapwtest prd02:/u02/app/oracle/product/12.2.0/dbhome_1/dbs

oracle@prd02's password:

orapwtest                                                                   100% 6144     2.6MB/s00:00

[oracle@PRD01 dbs]$



[oracle@prd02 dbs]$ mv orapwtest orapwtest_stand

[oracle@prd02 dbs]$


ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;


 ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;

SQL>  ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=30;

System altered.

SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;

System altered.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

configure listener and

 tnsnames.ora on both the side , it should be ping able from both the end.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

cp pfile from primary to secondary 

make neccessary change in secondary/

startup nomount =======standby

on primary

rman target sys/Welcome_231@test auxiliary sys/Welcome_231@test_stand


RMAN> connect auxiliary sys/XX@dup


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-04006: error from auxiliary database: ORA-01017: invalid username/password; logon denied



recreate password for sys in oracle and create orapwd file as below


orapwd file=orapwtest password=Welcome_231 force=y entries=10


rman TARGET sys/Welcome_123@test  AUXILIARY sys/Welcome_123@test_stand


[oracle@demo dbs]$ rman target /


Recovery Manager: Release 12.2.0.1.0 - Production on Tue Feb 23 13:50:24 2021


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


connected to target database: TEST (DBID=2362193459)


RMAN> connect auxiliary sys/Welcome_231@test_stand


connected to auxiliary database: TEST (not mounted)



duplicate target database for standby from active database nofilenamecheck;


select name,database_role,open_mode from v$database;


Enable the recovery:


SQL> alter database recover managed standby database disconnect from session;


SELECT ARCH.THREAD# “Thread”, ARCH.SEQUENCE# “Last Sequence Received”, APPL.SEQUENCE# “Last Sequence Applied”, (ARCH.SEQUENCE# – APPL.SEQUENCE#) “Difference” FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;



SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;



How To Enable Active Dataguard In Physical Standby Database


SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;


 SEQUENCE# APPLIED

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

        16 YES

        17 YES

        18 IN-MEMORY


SQL> /


 SEQUENCE# APPLIED

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

        16 YES

        17 YES

        18 YES

        19 YES

        20 YES

        21 IN-MEMORY


6 rows selected.


SQL> alter database recover managed standby database cancel;


Database altered.


alter database recover managed standby database cancel;



SQL> alter database open;


Database altered.


SQL> select name,open_mode from v$database;


NAME      OPEN_MODE

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

TEST      READ ONLY


start the media recover


alter database recover managed standby database using current logfile disconnect from session;


SQL> select name,open_mode from v$database;


NAME      OPEN_MODE

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

TEST      READ ONLY WITH APPLY


SELECT NAME,OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;


select * from v$logfile;



select b.thread#,a.group#, a.type, a.member, b.bytes FROM v$logfile a, v$standby_log b WHERE a.group# = b.group#;


SELECT NAME,OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;




Thanks

Ravi 

Wednesday 10 February 2021

Table recovery using RMAN Backup


Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production


SQL> connect sita/sita

Connected.

SQL> create table emp(id number);


Table created.


SQL> begin

for i in 1 .. 100000 loop

insert into emp values(i);

end loop;

end;

/  2    3    4    5    6


PL/SQL procedure successfully completed.


SQL> /


PL/SQL procedure successfully completed.


SQL> select count(*) from emp;


  COUNT(*)

----------

    200000


SQL>

SQL>

SQL> commit;


Commit complete.


SQL> archive log list;

ORA-01031: insufficient privileges

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@oracle ~]$ rman target /


Recovery Manager: Release 12.2.0.1.0 - Production on Wed Feb 10 16:05:01 2021


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


connected to target database: DEMO (DBID=3807952967)


RMAN> backup database plus archivelog;



Starting backup at 10-FEB-21

current log archived

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=72 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=14 RECID=1 STAMP=1064159388

input archived log thread=1 sequence=15 RECID=2 STAMP=1064159407

input archived log thread=1 sequence=16 RECID=3 STAMP=1064160323

channel ORA_DISK_1: starting piece 1 at 10-FEB-21

channel ORA_DISK_1: finished piece 1 at 10-FEB-21

piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_annnn_TAG20210210T160525_j27fqfbx_.bkp tag=TAG20210210T160525 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03

Finished backup at 10-FEB-21


Starting backup at 10-FEB-21

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/demo/system01.dbf

input datafile file number=00002 name=/u01/app/oracle/oradata/demo/sysaux01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/demo/users01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/demo/undotbs01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/demo/usertbs01.dbf

input datafile file number=00007 name=/u01/app/oracle/oradata/demo/hmld01.dbf

input datafile file number=00006 name=/u01/app/oracle/oradata/demo/lmauto01.dbf

channel ORA_DISK_1: starting piece 1 at 10-FEB-21

channel ORA_DISK_1: finished piece 1 at 10-FEB-21

piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_nnndf_TAG20210210T160528_j27fqkpc_.bkp tag=TAG20210210T160528 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

Finished backup at 10-FEB-21


Starting backup at 10-FEB-21

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=17 RECID=4 STAMP=1064160344

channel ORA_DISK_1: starting piece 1 at 10-FEB-21

channel ORA_DISK_1: finished piece 1 at 10-FEB-21

piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_annnn_TAG20210210T160544_j27fr10o_.bkp tag=TAG20210210T160544 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 10-FEB-21


Starting Control File Autobackup at 10-FEB-21

piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/autobackup/2021_02_10/o1_mf_n_1064160346_j27fr2nf_.bkp comment=NONE

Finished Control File Autobackup at 10-FEB-21


RMAN> exit



Recovery Manager complete.

[oracle@oracle ~]$ sqlplus "/as sysdba"


SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 10 16:05:56 2021


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



Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production


SQL> connect sita/sita

Connected.

SQL> SELECT TO_CHAR (SYSDATE, 'MM-DD-YYYY HH24:MI:SS') "NOW" FROM DUAL;


NOW

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

02-10-2021 16:06:20


SQL> drop table emp;


Table dropped.


SQL> commit;


Commit complete.






 [oracle@oracle ~]$ rman target /


Recovery Manager: Release 12.2.0.1.0 - Production on Wed Feb 10 16:07:05 2021


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


connected to target database: DEMO (DBID=3807952967)


RMAN> recover table sita.emp until time "to_date('2021-02-10 16:05:35','yyyy-mm-dd:hh24:mi:ss')" auxiliary destination '/u01/fra/';


Starting recover at 10-FEB-21

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=61 device type=DISK

RMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time


List of tablespaces expected to have UNDO segments

Tablespace SYSTEM

Tablespace UNDOTBS1


Creating automatic instance, with SID='erwk'


initialization parameters used for automatic instance:

db_name=DEMO

db_unique_name=erwk_pitr_DEMO

compatible=12.2.0

db_block_size=8192

db_files=200

diagnostic_dest=/u01/app/oracle

_system_trig_enabled=FALSE

sga_target=1004M

processes=200

db_create_file_dest=/u01/fra/

log_archive_dest_1='location=/u01/fra/'

#No auxiliary parameter file used



starting up automatic instance DEMO


Oracle instance started


Total System Global Area    1052770304 bytes


Fixed Size                     8628688 bytes

Variable Size                276825648 bytes

Database Buffers             763363328 bytes

Redo Buffers                   3952640 bytes

Automatic instance created


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2021-02-10 16:05:35','yyyy-mm-dd:hh24:mi:ss')";

# restore the controlfile

restore clone controlfile;


# mount the controlfile

sql clone 'alter database mount clone database';


# archive current online log

sql 'alter system archive log current';

}

executing Memory Script


executing command: SET until clause


Starting restore at 10-FEB-21

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=37 device type=DISK


channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: restoring control file

channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/demo/DEMO/autobackup/2021_02_10/o1_mf_n_1064159409_j27dts9t_.bkp

channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/autobackup/2021_02_10/o1_mf_n_1064159409_j27dts9t_.bkp tag=TAG20210210T155009

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

output file name=/u01/fra/DEMO/controlfile/o1_mf_j27fx598_.ctl

Finished restore at 10-FEB-21


sql statement: alter database mount clone database


sql statement: alter system archive log current


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2021-02-10 16:05:35','yyyy-mm-dd:hh24:mi:ss')";

# set destinations for recovery set and auxiliary set datafiles

set newname for clone datafile  1 to new;

set newname for clone datafile  3 to new;

set newname for clone datafile  2 to new;

set newname for clone tempfile  1 to new;

# switch all tempfiles

switch clone tempfile all;

# restore the tablespaces in the recovery set and the auxiliary set

restore clone datafile  1, 3, 2;


switch clone datafile all;

}

executing Memory Script


executing command: SET until clause


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


renamed tempfile 1 to /u01/fra/DEMO/datafile/o1_mf_tempts1_%u_.tmp in control file


Starting restore at 10-FEB-21

using channel ORA_AUX_DISK_1


channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/fra/DEMO/datafile/o1_mf_system_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/fra/DEMO/datafile/o1_mf_undotbs1_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/fra/DEMO/datafile/o1_mf_sysaux_%u_.dbf

channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_nnndf_TAG20210210T160528_j27fqkpc_.bkp

channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_nnndf_TAG20210210T160528_j27fqkpc_.bkp tag=TAG20210210T160528

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:27

Finished restore at 10-FEB-21


datafile 1 switched to datafile copy

input datafile copy RECID=4 STAMP=1064160547 file name=/u01/fra/DEMO/datafile/o1_mf_system_j27fxfbp_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=5 STAMP=1064160547 file name=/u01/fra/DEMO/datafile/o1_mf_undotbs1_j27fxfbz_.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=6 STAMP=1064160547 file name=/u01/fra/DEMO/datafile/o1_mf_sysaux_j27fxfbv_.dbf


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2021-02-10 16:05:35','yyyy-mm-dd:hh24:mi:ss')";

# online the datafiles restored or switched

sql clone "alter database datafile  1 online";

sql clone "alter database datafile  3 online";

sql clone "alter database datafile  2 online";

# recover and open database read only

recover clone database tablespace  "SYSTEM", "UNDOTBS1", "SYSAUX";

sql clone 'alter database open read only';

}

executing Memory Script


executing command: SET until clause


sql statement: alter database datafile  1 online


sql statement: alter database datafile  3 online


sql statement: alter database datafile  2 online


Starting recover at 10-FEB-21

using channel ORA_AUX_DISK_1


starting media recovery


archived log for thread 1 with sequence 16 is already on disk as file /u01/archive/1_16_1063882631.arc

archived log for thread 1 with sequence 17 is already on disk as file /u01/archive/1_17_1063882631.arc

archived log file name=/u01/archive/1_16_1063882631.arc thread=1 sequence=16

archived log file name=/u01/archive/1_17_1063882631.arc thread=1 sequence=17

media recovery complete, elapsed time: 00:00:02

Finished recover at 10-FEB-21


sql statement: alter database open read only


contents of Memory Script:

{

   sql clone "create spfile from memory";

   shutdown clone immediate;

   startup clone nomount;

   sql clone "alter system set  control_files =

  ''/u01/fra/DEMO/controlfile/o1_mf_j27fx598_.ctl'' comment=

 ''RMAN set'' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

# mount database

sql clone 'alter database mount clone database';

}

executing Memory Script


sql statement: create spfile from memory


database closed

database dismounted

Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area    1052770304 bytes


Fixed Size                     8628688 bytes

Variable Size                276825648 bytes

Database Buffers             763363328 bytes

Redo Buffers                   3952640 bytes


sql statement: alter system set  control_files =   ''/u01/fra/DEMO/controlfile/o1_mf_j27fx598_.ctl'' comment= ''RMAN set'' scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area    1052770304 bytes


Fixed Size                     8628688 bytes

Variable Size                276825648 bytes

Database Buffers             763363328 bytes

Redo Buffers                   3952640 bytes


sql statement: alter database mount clone database


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2021-02-10 16:05:35','yyyy-mm-dd:hh24:mi:ss')";

# set destinations for recovery set and auxiliary set datafiles

set newname for datafile  4 to new;

# restore the tablespaces in the recovery set and the auxiliary set

restore clone datafile  4;


switch clone datafile all;

}

executing Memory Script


executing command: SET until clause


executing command: SET NEWNAME


Starting restore at 10-FEB-21

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=34 device type=DISK


channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/fra/ERWK_PITR_DEMO/datafile/o1_mf_users01_%u_.dbf

channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_nnndf_TAG20210210T160528_j27fqkpc_.bkp

channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/demo/DEMO/backupset/2021_02_10/o1_mf_nnndf_TAG20210210T160528_j27fqkpc_.bkp tag=TAG20210210T160528

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07

Finished restore at 10-FEB-21


datafile 4 switched to datafile copy

input datafile copy RECID=8 STAMP=1064160641 file name=/u01/fra/ERWK_PITR_DEMO/datafile/o1_mf_users01_j27g116z_.dbf


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2021-02-10 16:05:35','yyyy-mm-dd:hh24:mi:ss')";

# online the datafiles restored or switched

sql clone "alter database datafile  4 online";

# recover and open resetlogs

recover clone database tablespace  "USERS01", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;

alter clone database open resetlogs;

}

executing Memory Script


executing command: SET until clause


sql statement: alter database datafile  4 online


Starting recover at 10-FEB-21

using channel ORA_AUX_DISK_1


starting media recovery


archived log for thread 1 with sequence 17 is already on disk as file /u01/archive/1_17_1063882631.arc

archived log file name=/u01/archive/1_17_1063882631.arc thread=1 sequence=17

media recovery complete, elapsed time: 00:00:00

Finished recover at 10-FEB-21


database opened


contents of Memory Script:

{

# create directory for datapump import

sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''

/u01/fra/''";

# create directory for datapump export

sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''

/u01/fra/''";

}

executing Memory Script


sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/fra/''


sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/fra/''


Performing export of tables...

   EXPDP> Starting "SYS"."TSPITR_EXP_erwk_wofm":

   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE

   EXPDP> . . exported "SITA"."EMP"                                1.700 MB  200000 rows

   EXPDP> Master table "SYS"."TSPITR_EXP_erwk_wofm" successfully loaded/unloaded

   EXPDP> ******************************************************************************

   EXPDP> Dump file set for SYS.TSPITR_EXP_erwk_wofm is:

   EXPDP>   /u01/fra/tspitr_erwk_19724.dmp

   EXPDP> Job "SYS"."TSPITR_EXP_erwk_wofm" successfully completed at Wed Feb 10 16:12:33 2021 elapsed 0 00:01:22

Export completed



contents of Memory Script:

{

# shutdown clone before import

shutdown clone abort

}

executing Memory Script


Oracle instance shut down


Performing import of tables...

   IMPDP> Master table "SYS"."TSPITR_IMP_erwk_Cxwf" successfully loaded/unloaded

   IMPDP> Starting "SYS"."TSPITR_IMP_erwk_Cxwf":

   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE

   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

   IMPDP> . . imported "SITA"."EMP"                                1.700 MB  200000 rows

   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

   IMPDP> Job "SYS"."TSPITR_IMP_erwk_Cxwf" successfully completed at Wed Feb 10 16:12:59 2021 elapsed 0 00:00:12

Import completed



Removing automatic instance

Automatic instance removed

auxiliary instance file /u01/fra/DEMO/datafile/o1_mf_tempts1_j27fymdd_.tmp deleted

auxiliary instance file /u01/fra/ERWK_PITR_DEMO/onlinelog/o1_mf_3_j27g1k6p_.log deleted

auxiliary instance file /u01/fra/ERWK_PITR_DEMO/onlinelog/o1_mf_2_j27g1j7m_.log deleted

auxiliary instance file /u01/fra/ERWK_PITR_DEMO/onlinelog/o1_mf_1_j27g1cqs_.log deleted

auxiliary instance file /u01/fra/ERWK_PITR_DEMO/datafile/o1_mf_users01_j27g116z_.dbf deleted

auxiliary instance file /u01/fra/DEMO/datafile/o1_mf_sysaux_j27fxfbv_.dbf deleted

auxiliary instance file /u01/fra/DEMO/datafile/o1_mf_undotbs1_j27fxfbz_.dbf deleted

auxiliary instance file /u01/fra/DEMO/datafile/o1_mf_system_j27fxfbp_.dbf deleted

auxiliary instance file /u01/fra/DEMO/controlfile/o1_mf_j27fx598_.ctl deleted

auxiliary instance file tspitr_erwk_19724.dmp deleted

Finished recover at 10-FEB-21


RMAN> exit


Thursday 4 February 2021

tablespaces in oracle

 Oracle divides a database into one or more logical storage units called tablespaces.

Each tablespace consists of one or more files called datafiles. A datafile physically stores the data objects of the database such as tables and indexes on disk.

In other words, Oracle logically stores data in the tablespaces and physically stores data in datafiles associated with the corresponding tablespaces.

The following picture illustrates the relationship between a database, tablespaces, and datafiles:

Oracle tablespace

By using tablespaces, you can perform the following operations:

  • Control the storage size allocated for the database data.
  • Grant specific space quotas to the database users.
  • Control the availability of data by taking tablespaces online or offline (more on this later).
  • Improve the performance of the database by allocating data storage across devices.
  • Perform partial database backup or recovery.

Default tablespaces in Oracle

Oracle comes with the following default tablespaces: SYSTEMSYSAUXUSERSUNDOTBS1, and TEMP.

  • The SYSTEM and SYSAUX tablespaces store system-generated objects such as data dictionary tables. And you should not store any object in these tablespaces.
  • The USERS tablespace is helpful for ad-hoc users.
  • The UNDOTBS1 holds the undo data.
  • The TEMP is the temporary tablespace which is used for storing intermediate results of sorting, hashing, and large object processing operations.

Online and Offline Tablespaces

A tablespace can be online or offline. If a tablespace is offline, you cannot access data stored in it. On the other hand, if a tablespace is online, its data is available for reading and writing.

Note that the SYSTEM tablespace must always be online because it contains the data dictionary that must be available to Oracle.

Normally, a tablespace is online so that its data is available to users. However, you can take a tablespace offline to make data inaccessible to users when you update and maintain the applications.

In case of some errors such as hardware failures, Oracle automatically takes an online tablespace offline. Any attempt to access data in offline tablespace will result in an error.

Read-Only Tablespaces

The read-only tablespaces allow Oracle to avoid performing backup and recovery of large, static parts of a database. Because Oracle doesn’t update the files of a read-only tablespace, you can store the files on the read-only media.

Oracle allows you to remove objects such as tables and indexes from a read-only tablespace. However, it does not allow you to create or alter objects in a read-only tablespace.

When you create a new tablespace, it is in the read-write mode. To change a tablespace to read-only tablespace, you use the ALTER TABLESPACE command with the READ ONLY option.

More on Oracle Tablespaces


Types of Tablespaces in Oracle Database

We can differentiate tablespaces on the basis of two factors:

  1. Type of Data
  2. Size of Data

Type of data consists of 3 kinds of tablespace including: 

  1. Permanent Tablespace
  2. Temporary Tablespace
  3. Undo Tablespace

And on the basis of Size of Data we have 2 kinds of tablespace:

  1. Big file tablespace
  2. Small file tablespace
Ref: oracletutorial

Featured post

Postgres commads

 [oracle@Tesdb ~]$ systemctl status postgresql-15 ● postgresql-15.service - PostgreSQL 15 database server    Loaded: loaded (/usr/lib/system...