Friday, April 28, 2023

Standalone File System(FS) to RAC Cloning - Easy Steps

Standalone File System(FS) to RAC Database Cloning:


High Level Steps:

1. Prechecks - Take Source DB backups and Transfer it to Target:
2. Method 1: Restore and Recover scenario:
3. Method 2: RMAN Clone scenario:
4. Post Restore/Clone Steps:

1. Prechecks - Take Source DB backups and Transfer it to Target:

###############################################################################
rman target /
run {
allocate channel ch1 device type disk;
backup as backupset database format '/u01/backup/Fullback_%T_%U'
plus archivelog format '/u01/backup/Archive_%T_%U';
backup current controlfile format '/u01/backup/Controlback_%T_%U';
backup spfile format '/u01/backup/spfile_%T_%U';
release channel ch1;
}

scp /u01/backup/* oracle@target:/u01/backup/.
###############################################################################

[oracle@oraclelab1 backup]$ ps -ef|grep smon
oracle   14582     1  0 10:28 ?        00:00:00 ora_smon_DEVDB
oracle   31672 31500  0 23:41 pts/0    00:00:00 grep --color=auto smon

[oracle@oraclelab1 backup]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Apr 26 23:41:16 2023
Version 19.3.0.0.0

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

connected to target database: DEVDB (DBID=1039854224)

RMAN> run {
allocate channel ch1 device type disk;
2> 3> backup as backupset database format '/u01/backup/Fullback_%T_%U'
plus archivelog format '/u01/backup/Archive_%T_%U';
backup current controlfile format '/u01/backup/Controlback_%T_%U';
4> 5> 6> backup spfile format '/u01/backup/spfile_%T_%U';
release channel ch1;
}
7> 8>
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=18 device type=DISK


Starting backup at 26-APR-23
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=4 RECID=1 STAMP=1135124497
input archived log thread=1 sequence=5 RECID=2 STAMP=1135125080
input archived log thread=1 sequence=6 RECID=3 STAMP=1135125089
input archived log thread=1 sequence=7 RECID=4 STAMP=1135158360
input archived log thread=1 sequence=8 RECID=5 STAMP=1135158404
input archived log thread=1 sequence=9 RECID=6 STAMP=1135160099
input archived log thread=1 sequence=10 RECID=7 STAMP=1135160926
input archived log thread=1 sequence=11 RECID=8 STAMP=1135202408
input archived log thread=1 sequence=12 RECID=9 STAMP=1135202419
input archived log thread=1 sequence=13 RECID=10 STAMP=1135208442
input archived log thread=1 sequence=14 RECID=11 STAMP=1135208449
input archived log thread=1 sequence=15 RECID=12 STAMP=1135208480
channel ch1: starting piece 1 at 26-APR-23
channel ch1: finished piece 1 at 26-APR-23
piece handle=/u01/backup/Archive_20230426_0j1qjq10_1_1 tag=TAG20230426T234120 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:03
Finished backup at 26-APR-23

Starting backup at 26-APR-23
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_l4j7ykl0_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_l4j7znom_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_l4j80frn_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_l4j80gv2_.dbf
channel ch1: starting piece 1 at 26-APR-23
channel ch1: finished piece 1 at 26-APR-23
piece handle=/u01/backup/Fullback_20230426_0k1qjq14_1_1 tag=TAG20230426T234123 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:03
Finished backup at 26-APR-23

Starting backup at 26-APR-23
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=16 RECID=13 STAMP=1135208487
channel ch1: starting piece 1 at 26-APR-23
channel ch1: finished piece 1 at 26-APR-23
piece handle=/u01/backup/Archive_20230426_0l1qjq17_1_1 tag=TAG20230426T234127 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-APR-23

Starting backup at 26-APR-23
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
channel ch1: starting piece 1 at 26-APR-23
channel ch1: finished piece 1 at 26-APR-23
piece handle=/u01/backup/Controlback_20230426_0m1qjq18_1_1 tag=TAG20230426T234128 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-APR-23

Starting backup at 26-APR-23
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ch1: starting piece 1 at 26-APR-23
channel ch1: finished piece 1 at 26-APR-23
piece handle=/u01/backup/spfile_20230426_0n1qjq1a_1_1 tag=TAG20230426T234130 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-APR-23

Starting Control File and SPFILE Autobackup at 26-APR-23
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2023_04_26/o1_mf_s_1135208491_l4ltbmt0_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 26-APR-23

released channel: ch1

RMAN> exit
Recovery Manager complete.

[oracle@oraclelab1 backup]$ ls -ltrh
total 1.8G
-rw-r-----. 1 oracle oinstall 521M Apr 26 23:41 Archive_20230426_0j1qjq10_1_1
-rw-r-----. 1 oracle oinstall 1.2G Apr 26 23:41 Fullback_20230426_0k1qjq14_1_1
-rw-r-----. 1 oracle oinstall 4.5K Apr 26 23:41 Archive_20230426_0l1qjq17_1_1
-rw-r-----. 1 oracle oinstall  11M Apr 26 23:41 Controlback_20230426_0m1qjq18_1_1
-rw-r-----. 1 oracle oinstall 112K Apr 26 23:41 spfile_20230426_0n1qjq1a_1_1

[oracle@oraclelab1 backup]$ scp * oracle@10.38.4.186:/u01/backup/
oracle@10.38.4.186's password:
Archive_20230426_0j1qjq10_1_1                                                                                           100%  520MB 104.0MB/s   00:05
Archive_20230426_0l1qjq17_1_1                                                                                           100% 4608     2.7MB/s   00:00
Controlback_20230426_0m1qjq18_1_1                                                                                       100%   10MB  93.2MB/s   00:00
Fullback_20230426_0k1qjq14_1_1                                                                                          100% 1224MB 122.4MB/s   00:10
spfile_20230426_0n1qjq1a_1_1                                                                                            100%  112KB  24.0MB/s   00:00
[oracle@oraclelab1 backup]$

[oracle@oraclelab1 onlinelog]$ env |grep ORA
ORACLE_SID=DEVDB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclelab1 onlinelog]$
[oracle@oraclelab1 onlinelog]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:11:04 2023
Version 19.3.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select name,dbid, open_mode from v$database;

NAME            DBID OPEN_MODE
--------- ---------- --------------------
DEVDB     1039854224 READ WRITE

SQL>

2. Method 1: Restore and Recover scenario:

###############################################################################
sqlplus / as sysdba
startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora';

rman target /
restore spfile from '/u01/backup/spfile_20220218_0a0m417c_1_1';
restore controlfile from '/u01/backup/Controlback_20220521_190u21pb_1_1';
alter database mount;
catalog start with '/u01/backup/';
run {
restore database;
recover database;
}
alter database open resetlogs;

sqlplus / as sysdba
select name, open_mode from v$database;
###############################################################################

[oracle@oranode1 backup]$ ps -ef|grep smon
oracle   11005 10546  0 23:44 pts/0    00:00:00 grep --color=auto smon
root     15163     1  1 03:01 ?        00:16:41 /u01/app/19.0.0.0/grid/bin/osysmond.bin
oracle   15743     1  0 03:01 ?        00:00:01 asm_smon_+ASM1
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ cd /u01/backup/
[oracle@oranode1 backup]$ ll
total 1796760
-rw-r----- 1 oracle oinstall  545511424 Apr 26 23:43 Archive_20230426_0j1qjq10_1_1
-rw-r----- 1 oracle oinstall       4608 Apr 26 23:43 Archive_20230426_0l1qjq17_1_1
-rw-r----- 1 oracle oinstall   10682368 Apr 26 23:43 Controlback_20230426_0m1qjq18_1_1
-rw-r----- 1 oracle oinstall 1283563520 Apr 26 23:43 Fullback_20230426_0k1qjq14_1_1
-rw-r----- 1 oracle oinstall     114688 Apr 26 23:43 spfile_20230426_0n1qjq1a_1_1

[oracle@oranode1 backup]$ vi /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora
[oracle@oranode1 backup]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora
*.db_name=DEVDB
*.db_unique_name=DEVDB
*.cluster_database=false
*.audit_file_dest='/u01/app/oracle/admin/DEVDB/adump'
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_create_online_log_dest_2='+RECO'
*.db_file_name_convert='/u01/app/oracle/oradata/DEVDB/datafile','+DATA/DEVDB'
*.log_file_name_convert='/u01/app/oracle/oradata/DEVDB/onlinelog','+DATA/DEVDB','/u01/app/oracle/fast_recovery_area/DEVDB/onlinelog','+RECO/DEVDB'
*.control_files='+DATA/DEVDB/controlfile/control01.ctl','+RECO/DEVDB/controlfile/control02.ctl'
*.db_recovery_file_dest_size=8931M
*.db_recovery_file_dest='+RECO'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
[oracle@oranode1 backup]$ . oraenv
ORACLE_SID = [oracle] ? DEVDB
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/19.0.0.0/dbhome_1
The Oracle base has been set to /u01/app/oracle
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ env |grep ORA
ORACLE_SID=DEVDB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oranode1 backup]$
[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 26 23:49:24 2023
Version 19.17.0.0.0

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

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB.ora';
ORACLE instance started.

Total System Global Area  310377808 bytes
Fixed Size                  8895824 bytes
Variable Size             260046848 bytes
Database Buffers           33554432 bytes
Redo Buffers                7880704 bytes
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Apr 26 23:50:08 2023
Version 19.17.0.0.0

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

connected to target database: DEVDB (not mounted)

RMAN> RMAN> restore controlfile from '/u01/backup/Controlback_20230426_0m1qjq18_1_1';

Starting restore at 26-APR-23
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/DEVDB/controlfile/control01.ctl
output file name=+RECO/DEVDB/controlfile/control02.ctl
Finished restore at 26-APR-23

RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN> catalog start with '/u01/backup/';

Starting implicit crosscheck backup at 26-APR-23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=193 device type=DISK
Crosschecked 21 objects
Finished implicit crosscheck backup at 26-APR-23

Starting implicit crosscheck copy at 26-APR-23
using channel ORA_DISK_1
Finished implicit crosscheck copy at 26-APR-23

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /u01/backup/

List of Files Unknown to the Database
=====================================
File Name: /u01/backup/Controlback_20230426_0m1qjq18_1_1
File Name: /u01/backup/spfile_20230426_0n1qjq1a_1_1

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/backup/Controlback_20230426_0m1qjq18_1_1
File Name: /u01/backup/spfile_20230426_0n1qjq1a_1_1

RMAN> run {
restore database;
recover database;
}2> 3> 4>

Starting restore at 26-APR-23
using channel ORA_DISK_1

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 00001 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_system_l4j7ykl0_.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_sysaux_l4j7znom_.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_undotbs1_l4j80frn_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/DEVDB/datafile/o1_mf_users_l4j80gv2_.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/Fullback_20230426_0k1qjq14_1_1
channel ORA_DISK_1: piece handle=/u01/backup/Fullback_20230426_0k1qjq14_1_1 tag=TAG20230426T234123
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 26-APR-23

Starting recover at 26-APR-23
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=16
channel ORA_DISK_1: reading from backup piece /u01/backup/Archive_20230426_0l1qjq17_1_1
channel ORA_DISK_1: piece handle=/u01/backup/Archive_20230426_0l1qjq17_1_1 tag=TAG20230426T234127
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=+RECO/DEVDB/ARCHIVELOG/2023_04_26/thread_1_seq_16.257.1135209203 thread=1 sequence=16
channel default: deleting archived log(s)
archived log file name=+RECO/DEVDB/ARCHIVELOG/2023_04_26/thread_1_seq_16.257.1135209203 RECID=14 STAMP=1135209202
unable to find archived log
archived log thread=1 sequence=17
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/26/2023 23:53:23
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 17 and starting SCN of 2553806

RMAN> 
RMAN> alter database open resetlogs;

Statement processed
PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.03.00.00 in TARGET database is not current
PL/SQL package SYS.DBMS_RCVMAN version 19.03.00.00 in TARGET database is not current

RMAN> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/DEVDB/DATAFILE/system.264.1135209187
+DATA/DEVDB/DATAFILE/sysaux.265.1135209187
+DATA/DEVDB/DATAFILE/users.267.1135209187
+DATA/DEVDB/DATAFILE/undotbs1.266.1135209187
RMAN> exit

Recovery Manager complete.
[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 26 23:55:48 2023
Version 19.17.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> select name,dbid, open_mode from v$database;

NAME            DBID OPEN_MODE
--------- ---------- --------------------
DEVDB     1039854224 READ WRITE

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$

3. Method 2: RMAN Clone scenario:

###############################################################################
sqlplus / as sysdba
startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initTESTDB.ora';

rman auxiliary /
duplicate target database to TESTDB backup location '/u01/backup' nofilenamecheck;

sqlplus / as sysdba
select name, open_mode from v$database;
###############################################################################

[oracle@oranode1 backup]$ ps -ef|grep smon
oracle   13388     1  0 Apr26 ?        00:00:00 ora_smon_DEVDB
root     15163     1  1 Apr26 ?        00:17:07 /u01/app/19.0.0.0/grid/bin/osysmond.bin
oracle   15743     1  0 Apr26 ?        00:00:01 asm_smon_+ASM1
oracle   32042 10546  0 00:16 pts/0    00:00:00 grep --color=auto smon
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ cd /u01/backup/
[oracle@oranode1 backup]$ ll
total 1796760
-rw-r----- 1 oracle oinstall  545511424 Apr 26 23:43 Archive_20230426_0j1qjq10_1_1
-rw-r----- 1 oracle oinstall       4608 Apr 26 23:43 Archive_20230426_0l1qjq17_1_1
-rw-r----- 1 oracle oinstall   10682368 Apr 26 23:43 Controlback_20230426_0m1qjq18_1_1
-rw-r----- 1 oracle oinstall 1283563520 Apr 26 23:43 Fullback_20230426_0k1qjq14_1_1
-rw-r----- 1 oracle oinstall     114688 Apr 26 23:43 spfile_20230426_0n1qjq1a_1_1

[oracle@oranode1 backup]$ vi /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initTESTDB.ora
[oracle@oranode1 backup]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initTESTDB.ora
*.db_name=TESTDB
*.db_unique_name=TESTDB
*.cluster_database=false
*.audit_file_dest='/u01/app/oracle/admin/TESTDB/adump'
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_create_online_log_dest_2='+RECO'
*.db_file_name_convert='/u01/app/oracle/oradata/DEVDB/datafile/','+DATA/TESTDB'
*.log_file_name_convert='/u01/app/oracle/oradata/DEVDB/datafile/','+DATA/TESTDB','/u01/app/oracle/fast_recovery_area/DEVDB/onlinelog','+RECO/TESTDB'
*.control_files='+DATA/TESTDB/controlfile/control01.ctl','+RECO/TESTDB/controlfile/control02.ctl'
*.db_recovery_file_dest_size=8931M
*.db_recovery_file_dest='+RECO'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
[oracle@oranode1 backup]$
[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:10:12 2023
Version 19.17.0.0.0

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

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initTESTDB.ora';
ORACLE instance started.

Total System Global Area  310377808 bytes
Fixed Size                  8895824 bytes
Variable Size             260046848 bytes
Database Buffers           33554432 bytes
Redo Buffers                7880704 bytes
SQL>
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$ rman auxiliary /

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Apr 27 00:10:34 2023
Version 19.17.0.0.0

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

connected to auxiliary database: TESTDB (not mounted)

RMAN> duplicate target database to TESTDB backup location '/u01/backup' nofilenamecheck;

Starting Duplicate Db at 27-APR-23
searching for database ID
found backup of database ID 1039854224

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     310377808 bytes

Fixed Size                     8895824 bytes
Variable Size                260046848 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7880704 bytes

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

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     310377808 bytes

Fixed Size                     8895824 bytes
Variable Size                260046848 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7880704 bytes

Starting restore at 27-APR-23
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=23 device type=DISK

channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
output file name=+DATA/TESTDB/controlfile/control01.ctl
output file name=+RECO/TESTDB/controlfile/control02.ctl
Finished restore at 27-APR-23

database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=23 device type=DISK
RMAN-05158: WARNING: auxiliary (logfile) file name /u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_1_l4j81v61_.log conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (logfile) file name /u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_2_l4j81v70_.log conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (logfile) file name /u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_3_l4j81v7r_.log conflicts with a file used by the target database

contents of Memory Script:
{
   set until scn  2553806;
   set newname for datafile  1 to
 "+DATA/testdbo1_mf_system_l4j7ykl0_.dbf";
   set newname for datafile  3 to
 "+DATA/testdbo1_mf_sysaux_l4j7znom_.dbf";
   set newname for datafile  4 to
 "+DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf";
   set newname for datafile  7 to
 "+DATA/testdbo1_mf_users_l4j80gv2_.dbf";
   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

Starting restore at 27-APR-23
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 +DATA/testdbo1_mf_system_l4j7ykl0_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA/testdbo1_mf_sysaux_l4j7znom_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA/testdbo1_mf_users_l4j80gv2_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/Fullback_20230426_0k1qjq14_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/backup/Fullback_20230426_0k1qjq14_1_1 tag=TAG20230426T234123
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 27-APR-23

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

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=1135210338 file name=+DATA/testdbo1_mf_system_l4j7ykl0_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=1135210338 file name=+DATA/testdbo1_mf_sysaux_l4j7znom_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=1135210338 file name=+DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=1135210338 file name=+DATA/testdbo1_mf_users_l4j80gv2_.dbf

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

executing command: SET until clause

Starting recover at 27-APR-23
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=16
channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/Archive_20230426_0l1qjq17_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/backup/Archive_20230426_0l1qjq17_1_1 tag=TAG20230426T234127
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=+RECO/TESTDB/ARCHIVELOG/2023_04_27/thread_1_seq_16.267.1135210339 thread=1 sequence=16
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TESTDB/ARCHIVELOG/2023_04_27/thread_1_seq_16.267.1135210339 RECID=1 STAMP=1135210339
media recovery complete, elapsed time: 00:00:01
Finished recover at 27-APR-23
Oracle instance started

Total System Global Area     310377808 bytes

Fixed Size                     8895824 bytes
Variable Size                260046848 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7880704 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''TESTDB'' 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 =  ''TESTDB'' 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     310377808 bytes

Fixed Size                     8895824 bytes
Variable Size                260046848 bytes
Database Buffers              33554432 bytes
Redo Buffers                   7880704 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TESTDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP     1 ( '/u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_1_l4j81v61_.log', '+RECO/TESTDB/o1_mf_1_l4j81vd6_.log' ) SIZE 200 M  REUSE,
  GROUP     2 ( '/u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_2_l4j81v70_.log', '+RECO/TESTDB/o1_mf_2_l4j81wnb_.log' ) SIZE 200 M  REUSE,
  GROUP     3 ( '/u01/app/oracle/oradata/DEVDB/onlinelog/o1_mf_3_l4j81v7r_.log', '+RECO/TESTDB/o1_mf_3_l4j81wnq_.log' ) SIZE 200 M  REUSE
 DATAFILE
  '+DATA/testdbo1_mf_system_l4j7ykl0_.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "+DATA/testdbo1_mf_temp_l4j821kn_.tmp";
   switch clone tempfile all;
   catalog clone datafilecopy  "+DATA/testdbo1_mf_sysaux_l4j7znom_.dbf",
 "+DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf",
 "+DATA/testdbo1_mf_users_l4j80gv2_.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +DATA/testdbo1_mf_temp_l4j821kn_.tmp in control file

cataloged datafile copy
datafile copy file name=+DATA/testdbo1_mf_sysaux_l4j7znom_.dbf RECID=1 STAMP=1135210372
cataloged datafile copy
datafile copy file name=+DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf RECID=2 STAMP=1135210372
cataloged datafile copy
datafile copy file name=+DATA/testdbo1_mf_users_l4j80gv2_.dbf RECID=3 STAMP=1135210372

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1135210372 file name=+DATA/testdbo1_mf_sysaux_l4j7znom_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=1135210372 file name=+DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=3 STAMP=1135210372 file name=+DATA/testdbo1_mf_users_l4j80gv2_.dbf

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

database opened
Cannot remove created server parameter file
Finished Duplicate Db at 27-APR-23
PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.03.00.00 in AUXILIARY database is not current
PL/SQL package SYS.DBMS_RCVMAN version 19.03.00.00 in AUXILIARY database is not current

RMAN> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/testdbo1_mf_system_l4j7ykl0_.dbf
+DATA/testdbo1_mf_sysaux_l4j7znom_.dbf
+DATA/testdbo1_mf_users_l4j80gv2_.dbf
+DATA/testdbo1_mf_undotbs1_l4j80frn_.dbf
RMAN> exit

Recovery Manager complete.
[oracle@oranode1 backup]$
[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:13:22 2023
Version 19.17.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> select name,dbid, open_mode from v$database;

NAME            DBID OPEN_MODE
--------- ---------- --------------------
TESTDB    2918538497 READ WRITE

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$

4. Post Restore/Clone Steps:

###############################################################################
Move the dummy pfile(initDEVDB.ora) used for clone:
cp initDEVDB.ora initDEVDB.ora_Dummy_pfile_as_a_GOLD_Copy_for_future_clone

1. Get a pfile from source and modify according to target RAC environemtn
2. Start target instance1 using modified pfile from above step

Shutdown the Cloned database 
sqlplus / as sysdba
shut immediate

vi /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora

. oraenv
>>> DEVDB1

sqlplus / as sysdba
startup mount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora';

create spfile='+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora' from pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora';
shut immediate;

Copy the RAC parameters modified pfile(initDEVDB1.ora) for future clone:
cp initDEVDB1.ora initDEVDB1.ora_After_RAC_Parameter_Added_as_a_GOLD_Copy_for_future_clone

Create local pfile initDEVDB1.ora point to SPFILE '+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora'

Node1>>>
cd $ORACLE_HOME/dbs
cat > initDEVDB1.ora 
spfile='+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora'

Node2 >>>
cat > initDEVDB2.ora 
spfile='+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora'

Take a copy of initDEVDB1.ora and initDEVDB2.ora as a GOLD copy for future clones.
cp initDEVDB1.ora initDEVDB1.ora_GOLD_copy_Pointing_To_spfile
cp initDEVDB2.ora initDEVDB2.ora_GOLD_copy_Pointing_To_spfile

sqlplus / as sysdba
startup mount;
show parameter spfile
shut immediate

Convert DEVDB database to RAC

srvctl add database -d DEVDB -n DEVDB -o '/u01/app/oracle/product/19.0.0.0/dbhome_1' -p '+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora' -t IMMEDIATE -a 'DATA,RECO'

Add the NODE instances
srvctl add instance -d DEVDB -i DEVDB1 -n oraclelabnode1
srvctl add instance -d DEVDB -i DEVDB2 -n oraclelabnode2
srvctl add instance -d DEVDB -i DEVDB3 -n oraclelabnode3

srvctl config database -d DEVDB
srvctl status database -d DEVDB
srvctl start database -d DEVDB
srvctl status database -d DEVDB
srvctl stop database -d DEVDB

Add redo log threads for the RAC cluster nodes, Dafault it will create only 1 thread since we clonned from Standalone DB:
alter database add logfile thread 2 group 4 ('+DATA', '+RECO') SIZE 200M;
alter database add logfile thread 2 group 5 ('+DATA', '+RECO') SIZE 200M;
alter database add logfile thread 2 group 6 ('+DATA', '+RECO') SIZE 200M;

alter database enable thread 2;
###############################################################################

[oracle@oranode1 backup]$ ps -ef|grep smon
oracle   13388     1  0 Apr26 ?        00:00:00 ora_smon_DEVDB
root     15163     1  1 Apr26 ?        00:17:07 /u01/app/19.0.0.0/grid/bin/osysmond.bin
oracle   15743     1  0 Apr26 ?        00:00:01 asm_smon_+ASM1
oracle   29849     1  0 00:12 ?        00:00:00 ora_smon_TESTDB
oracle   32042 10546  0 00:16 pts/0    00:00:00 grep --color=auto smon
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ env |grep ORA
ORACLE_SID=DEVDB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:16:50 2023
Version 19.17.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$ vi /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora

[oracle@oranode1 backup]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora
DEVDB1.__data_transfer_cache_size=0
DEVDB2.__data_transfer_cache_size=0
DEVDB1.__db_cache_size=2768240640
DEVDB2.__db_cache_size=2768240640
DEVDB1.__inmemory_ext_roarea=0
DEVDB2.__inmemory_ext_roarea=0
DEVDB1.__inmemory_ext_rwarea=0
DEVDB2.__inmemory_ext_rwarea=0
DEVDB1.__java_pool_size=0
DEVDB2.__java_pool_size=0
DEVDB1.__large_pool_size=16777216
DEVDB2.__large_pool_size=16777216
DEVDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DEVDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DEVDB1.__pga_aggregate_target=1241513984
DEVDB2.__pga_aggregate_target=1241513984
DEVDB1.__sga_target=3707764736
DEVDB2.__sga_target=3707764736
DEVDB1.__shared_io_pool_size=134217728
DEVDB2.__shared_io_pool_size=134217728
DEVDB1.__shared_pool_size=771751936
DEVDB2.__shared_pool_size=771751936
DEVDB1.__streams_pool_size=0
DEVDB2.__streams_pool_size=0
DEVDB1.__unified_pga_pool_size=0
DEVDB2.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/DEVDB/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='19.0.0'
*.control_files='+DATA/DEVDB/controlfile/control01.ctl','+RECO/DEVDB/controlfile/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_name='DEVDB'
*.db_recovery_file_dest='+RECO'
*.db_recovery_file_dest_size=8931m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVDBXDB)'
family:dw_helper.instance_mode='read-only'
DEVDB1.instance_number=1
DEVDB2.instance_number=2
DEVDB1.local_listener='(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=oraclenode1-vip.localdomain.com)(PORT=1522))))'
DEVDB2.local_listener='(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=oraclenode1-vip.localdomain.com)(PORT=1522))))'
*.open_cursors=300
*.pga_aggregate_target=1174m
*.processes=300
*.remote_login_passwordfile='exclusive'
*.service_names='DEVDB'
*.sga_target=3522m
DEVDB2.thread=2
DEVDB1.thread=1
DEVDB2.undo_tablespace='UNDOTBS2'
DEVDB1.undo_tablespace='UNDOTBS1'
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ . oraenv
ORACLE_SID = [DEVDB] ? DEVDB1
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/19.0.0.0/dbhome_1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:18:00 2023
Version 19.17.0.0.0

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

Connected to an idle instance.

SQL> startup mount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora';
ORACLE instance started.

Total System Global Area 3707763120 bytes
Fixed Size                  8903088 bytes
Variable Size             788529152 bytes
Database Buffers         2902458368 bytes
Redo Buffers                7872512 bytes
Database mounted.
SQL> create spfile='+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora' from pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora';

File created.

SQL> shut immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$ cat > /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora
spfile='+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora'
^C
[oracle@oranode1 backup]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initDEVDB1.ora
spfile='+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora'
[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:19:50 2023
Version 19.17.0.0.0

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 3707763120 bytes
Fixed Size                  8903088 bytes
Variable Size             788529152 bytes
Database Buffers         2902458368 bytes
Redo Buffers                7872512 bytes
Database mounted.
SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/DEVDB/PARAMETERFILE/spfi
                                                 ledevdb.ora
SQL> shut immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

[oracle@oranode1 backup]$ srvctl add database -d DEVDB -n DEVDB -o '/u01/app/oracle/product/19.0.0.0/dbhome_1' -p '+DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora' -t IMMEDIATE -a 'DATA,RECO'

[oracle@oranode1 backup]$ srvctl add instance -d DEVDB -i DEVDB1 -n oranode1

[oracle@oranode1 backup]$ srvctl add instance -d DEVDB -i DEVDB2 -n oranode2

[oracle@oranode1 backup]$ srvctl config database -d DEVDB
Database unique name: DEVDB
Database name: DEVDB
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/DEVDB/PARAMETERFILE/spfileDEVDB.ora
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA,RECO
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: DEVDB1,DEVDB2
Configured nodes: oranode1,oranode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@oranode1 backup]$ srvctl status database -d DEVDB
Instance DEVDB1 is not running on node oranode1
Instance DEVDB2 is not running on node oranode2

[oracle@oranode1 backup]$ srvctl start database -d DEVDB
PRCR-1079 : Failed to start resource ora.devdb.db
CRS-5017: The resource action "ora.devdb.db start" encountered the following error:
ORA-01618: redo thread 2 is not enabled - cannot mount
. For details refer to "(:CLSN00107:)" in "/u01/app/oracle/diag/crs/oranode2/crs/trace/crsd_oraagent_oracle.trc".

CRS-2674: Start of 'ora.devdb.db' on 'oranode2' failed
[oracle@oranode1 backup]$

[oracle@oranode1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 00:24:01 2023
Version 19.17.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DATA/DEVDB/DATAFILE/system.264.1135209187
+DATA/DEVDB/DATAFILE/sysaux.265.1135209187
+DATA/DEVDB/DATAFILE/undotbs1.266.1135209187
+DATA/DEVDB/DATAFILE/undotbs2.282.1135210991
+DATA/DEVDB/DATAFILE/users.267.1135209187

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/DEVDB/controlfile/control01.ctl
+RECO/DEVDB/controlfile/control02.ctl

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+DATA/DEVDB/ONLINELOG/group_3.270.1135209277
+RECO/DEVDB/ONLINELOG/group_3.259.1135209279
+DATA/DEVDB/ONLINELOG/group_2.269.1135209277
+RECO/DEVDB/ONLINELOG/group_2.257.1135209279
+DATA/DEVDB/ONLINELOG/group_1.268.1135209277
+RECO/DEVDB/ONLINELOG/group_1.258.1135209279

6 rows selected.

SQL>

SQL> select GROUP#,THREAD#,MEMBERS,BYTES/1024/1024,MEMBERS from v$log;

    GROUP#    THREAD#    MEMBERS BYTES/1024/1024    MEMBERS
---------- ---------- ---------- --------------- ----------
         1          1          2             200          2
         2          1          2             200          2
         3          1          2             200          2

SQL>

alter database add logfile thread 2 group 4 ('+DATA', '+RECO') SIZE 200M;
alter database add logfile thread 2 group 5 ('+DATA', '+RECO') SIZE 200M;
alter database add logfile thread 2 group 6 ('+DATA', '+RECO') SIZE 200M;

alter database enable thread 2;

SQL> alter database add logfile thread 2 group 4 ('+DATA', '+RECO') SIZE 200M;

Database altered.

SQL> alter database add logfile thread 2 group 5 ('+DATA', '+RECO') SIZE 200M;

Database altered.

SQL> alter database add logfile thread 2 group 6 ('+DATA', '+RECO') SIZE 200M;

Database altered.

SQL> select GROUP#,THREAD#,MEMBERS,BYTES/1024/1024,MEMBERS from v$log;

    GROUP#    THREAD#    MEMBERS BYTES/1024/1024    MEMBERS
---------- ---------- ---------- --------------- ----------
         1          1          2             200          2
         2          1          2             200          2
         3          1          2             200          2
         4          2          2             200          2
         5          2          2             200          2
         6          2          2             200          2

6 rows selected.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+DATA/DEVDB/ONLINELOG/group_3.270.1135209277
+RECO/DEVDB/ONLINELOG/group_3.259.1135209279
+DATA/DEVDB/ONLINELOG/group_2.269.1135209277
+RECO/DEVDB/ONLINELOG/group_2.257.1135209279
+DATA/DEVDB/ONLINELOG/group_1.268.1135209277
+RECO/DEVDB/ONLINELOG/group_1.258.1135209279
+DATA/DEVDB/ONLINELOG/group_4.283.1135211495
+RECO/DEVDB/ONLINELOG/group_4.269.1135211497
+DATA/DEVDB/ONLINELOG/group_5.284.1135211505
+RECO/DEVDB/ONLINELOG/group_5.270.1135211507
+DATA/DEVDB/ONLINELOG/group_6.285.1135211509

MEMBER
--------------------------------------------------------------------------------
+RECO/DEVDB/ONLINELOG/group_6.271.1135211511

12 rows selected.

SQL> alter database enable thread 2;

Database altered.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oranode1 backup]$ srvctl start database -d DEVDB
[oracle@oranode1 backup]$ srvctl status database -d DEVDB
Instance DEVDB1 is running on node oranode1
Instance DEVDB2 is running on node oranode2
[oracle@oranode1 backup]$

Regards,
Mallik

All you need to know about Tablespaces in Oracle?

Default Tablespace, Default TEMP Tablespace and Default UNDO Tablespace:


What are default Tablespace in Oracle?

How to validate Default Tablespaces in Oracle Database?


Find Default Tablespace? 

SQL> SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME = 'DEFAULT_PERMANENT_TABLESPACE';

PROPERTY_VALUE
--------------------
USERS

Find Default TEMP Tablespace?

SQL> SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME = 'DEFAULT_TEMP_TABLESPACE';

PROPERTY_VALUE
--------------------
TEMP

SQL> SELECT PROPERTY_NAME, PROPERTY_VALUE FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME IN ('DEFAULT_PERMANENT_TABLESPACE','DEFAULT_TEMP_TABLESPACE');

PROPERTY_NAME PROPERTY_VALUE
------------------------------ --------------------
DEFAULT_PERMANENT_TABLESPACE USERS
DEFAULT_TEMP_TABLESPACE TEMP

Find Default UNDO Tablespace?

SQL> show parameter undo_tablespace
NAME TYPE VALUE
--------------- ------- ----------
undo_tablespace string UNDOTBS1

How to Change Default Tablespace, Default TEMP Tablespace and Default UNDO Tablespace 

ALTER DATABASE DEFAULT TABLESPACE USERS02;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP02;
ALTER SYSTEM SET UNDO_TABLESPACE = UNDOTBS2 SCOPE=BOTH;

How to Create more than 1 Default Tablespaces?

--- Its just like creation of normal tablespace but at any given point of time there will be only 1 Default Tablespace in my database.

CREATE TABLESPACE USERS02;
CREATE TABLESPACE USERS02 DATAFILE '/oradata/users02.dbf' SIZE 1000M AUTOEXTEND ON;
ALTER DATABASE DEFAULT TABLESPACE USERS02;

How to Create more than 1 Default TEMP Tablespaces?

Its just like creation of normal TEMP tablepace but at any given point of time there will be only 1 Default Tablespace in my database.

CREATE TEMPORARY TABLESPACE TEMP02;
CREATE TEMPORARY TABLESPACE TEMP02 TEMPFILE '/oradata/temp02.dbf' SIZE 1000M AUTOEXTEND ON;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP02;

How to Create more than 1 Default UNDO Tablespaces?


CREATE UNDO TABLESPACE UNDOTBS02;
CREATE UNDO TABLESPACE UNDOTBS02 DATAFILE '/oradata/undo02.dbf' SIZE 1000M AUTOEXTEND ON;
ALTER SYSTEM SET UNDO_TABLESPACE = UNDOTBS02 SCOPE=BOTH;

Set of Questions:

1. Can I have more than 1 UNDO Tablespaces?
2. Can I have more than 1 Default UNDO Tablespaces?

3. Can I have more than 1 TEMP Tablespaces?
4. Can I have more than 1 Default TEMP Tablespaces?

3. Can I have more than 1 Default Tablespaces?

Next super set of Questions?

1. Can I assign Multiple TABLESPACE to a single user?
2. Can a single user have multiple TEMP TABLESPACE?
3. Can a single user have multiple UNDO TABLESPACE?
4. Can multiple user have different TABLESPACE, TEMP and UNDO TABLESPACE?

Regards,
Mallik

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...