Friday, June 21, 2024

Flashback database to Guarantee Restore Point or Restore Point

Flashback database to Guarantee Restore Point or Restore Point after Upgrade from 12c to 19c


How to Perform Flashback Database after a Failed Database Upgrade (Doc ID 2882218.1)
How to Downgrade to 12c After Upgrade To 19c Using Flashback database (Doc ID 2887982.1)

We can flashback database at SQL command prompt as well as RMAN command prompt 

Here in this blog we are falshing back to GRP after the database upgrade fron 12c to 19c.
- GRP restore point was created in 12c and once we flashback database to GRP after 19c upgrade it will automatically downgrade to 12c.


High Level Steps:
=================
On 19c Home
SQL> shutdown immediate
SQL> startup mount
SQL> flashback database to restore point GRP1;
SQL> shutdown immediate;

on 12c Home
SQL> startup mount
SQL> alter database open resetlogs;


[root@hostnode1 ~]# ps -ef|grep smon
oracle    3022     1  0 10:49 ?        00:00:00 ora_smon_TEST1
root      9504  9238  0 15:51 pts/0    00:00:00 grep --color=auto smon
root     13767     1  1 May25 ?        00:27:10 /u01/app/19.0.0.0/grid/bin/osysmond.bin
oracle   14088     1  0 May25 ?        00:00:01 asm_smon_+ASM1
oracle   25219     1  0 11:40 ?        00:00:00 ora_smon_UAT1
oracle   26493     1  0 10:45 ?        00:00:00 ora_smon_DEV1

[root@hostnode1 ~]# su - oracle
Last login: Sun May 26 15:41:45 IST 2024

[oracle@hostnode1 ~]$ . oraenv
ORACLE_SID = [oracle] ? DEV1
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@hostnode1 ~]$

[oracle@hostnode1 ~]$ srvctl status database -d DEV
Instance DEV1 is running on node hostnode1
Instance DEV2 is running on node hostnode2
[oracle@hostnode1 ~]$

[oracle@hostnode1 ~]$ srvctl config database -d DEV
Database unique name: DEV
Database name: DEV
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/DEV/PARAMETERFILE/spfile.319.1169935561
Password file: +DATA/DEV/PASSWORD/pwddev.269.1169935335
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECO,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: DEV1,DEV2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@hostnode1 ~]$

[oracle@hostnode1 ~]$ srvctl stop database -d DEV
[oracle@hostnode1 ~]$ srvctl status database -d DEV
Instance DEV1 is not running on node hostnode1
Instance DEV2 is not running on node hostnode2
[oracle@hostnode1 ~]$

[oracle@hostnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun May 26 15:54:52 2024
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 3690985856 bytes
Fixed Size                  8903040 bytes
Variable Size             989855744 bytes
Database Buffers         2684354560 bytes
Redo Buffers                7872512 bytes
Database mounted.
SQL>

SQL> set pages 1000 lines 1000
col TIME for a35
col RESTORE_POINT_TIME for a30
col NAME for a30
select SCN,DATABASE_INCARNATION#,GUARANTEE_FLASHBACK_DATABASE,TIME,RESTORE_POINT_TIME,NAME,PDB_RESTORE_POINT from v$restore_point;               2

       SCN DATABASE_INCARNATION# GUA TIME                                RESTORE_POINT_TIME             NAME                           PDB
---------- --------------------- --- ----------------------------------- ------------------------------ ------------------------------ ---
   1550262                     2 YES 26-MAY-24 09.12.24.000000000 AM                                    BEFORE_UPGRADE                 NO

SQL>

SQL> flashback database to restore point BEFORE_UPGRADE;

Flashback complete.

SQL> shut immediate;
Database dismounted.
ORACLE instance shut down.
SQL>

[root@hostnode1 ~]# tail -100f /u01/app/oracle/diag/rdbms/dev/DEV1/trace/alert_DEV1.log
2024-06-05T23:15:53.393655+05:30
flashback database to restore point BEFORE_UPGRADE
2024-06-05T23:15:55.041279+05:30
Flashback Restore Start
2024-06-05T23:16:03.045947+05:30
Flashback Restore Complete
Flashback Media Recovery Start
 Started logmerger process
2024-06-05T23:16:04.213698+05:30
Parallel Media Recovery started with 2 slaves
Flashback Media Recovery Log +RECO/DEV/ARCHIVELOG/2024_05_26/thread_1_seq_3.309.1169976533
2024-06-05T23:16:04.649010+05:30
ALTER SYSTEM SET remote_listener=' hostscan.localdomain.com:1521' SCOPE=MEMORY SID='DEV1';
2024-06-05T23:16:04.651212+05:30
ALTER SYSTEM SET listener_networks='' SCOPE=MEMORY SID='DEV1';
Flashback Media Recovery Log +RECO/DEV/ARCHIVELOG/2024_05_26/thread_2_seq_1.306.1169976533
2024-06-05T23:16:05.142464+05:30
Incomplete Recovery applied until change 1550263 time 05/26/2024 09:12:31
2024-06-05T23:16:05.146121+05:30
Flashback Media Recovery Complete
2024-06-05T23:16:05.436014+05:30
Completed: flashback database to restore point BEFORE_UPGRADE

[oracle@hostnode1 ~]$ srvctl config database -d DEV
Database unique name: DEV
Database name: DEV
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/DEV/PARAMETERFILE/spfile.319.1169935561
Password file: +DATA/DEV/PASSWORD/pwddev.269.1169935335
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECO,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: DEV1,DEV2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@hostnode1 ~]$

[oracle@hostnode1 ~]$ . oraenv
ORACLE_SID = [oracle] ? DEV1
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/12.2.0.1/dbhome_1
The Oracle base has been set to /u01/app/oracle
[oracle@hostnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Jun 5 23:30:27 2024

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 3690987520 bytes
Fixed Size                  8627200 bytes
Variable Size             905972736 bytes
Database Buffers         2768240640 bytes
Redo Buffers                8146944 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@hostnode1 ~]$

[oracle@hostnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Jun 5 23:36:39 2024

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

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 3690987520 bytes
Fixed Size                  8627200 bytes
Variable Size             905972736 bytes
Database Buffers         2768240640 bytes
Redo Buffers                8146944 bytes
Database mounted.
Database opened.
SQL>
SQL> column comp_name format a40
coluSQL> mn version format a12
column staSQL> tus format a15
select comp_name,SQL> version,status from dba_registry;

COMP_NAME                                VERSION      STATUS
---------------------------------------- ------------ ---------------
Oracle Database Catalog Views            12.2.0.1.0   VALID
Oracle Database Packages and Types       12.2.0.1.0   VALID
JServer JAVA Virtual Machine             12.2.0.1.0   VALID
Oracle XDK                               12.2.0.1.0   VALID
Oracle Database Java Packages            12.2.0.1.0   VALID
OLAP Analytic Workspace                  12.2.0.1.0   VALID
Oracle Real Application Clusters         12.2.0.1.0   VALID
Oracle XML Database                      12.2.0.1.0   VALID
Oracle Workspace Manager                 12.2.0.1.0   VALID
Oracle Text                              12.2.0.1.0   VALID
Oracle Multimedia                        12.2.0.1.0   VALID

COMP_NAME                                VERSION      STATUS
---------------------------------------- ------------ ---------------
Spatial                                  12.2.0.1.0   VALID
Oracle OLAP API                          12.2.0.1.0   VALID
Oracle Label Security                    12.2.0.1.0   VALID
Oracle Database Vault                    12.2.0.1.0   VALID

15 rows selected.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@hostnode1 ~]$

[oracle@hostnode1 ~]$ /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/srvctl downgrade database -d DEV -oraclehome /u01/app/oracle/product/12.2.0.1/dbhome_1 -targetversion 12.2.0.1.0

[oracle@hostnode1 ~]$ env |grep ORA
ORACLE_SID=DEV1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/dbhome_1
[oracle@hostnode1 ~]$
[oracle@hostnode1 ~]$ srvctl config database -d DEV
Database unique name: DEV
Database name: DEV
Oracle home: /u01/app/oracle/product/12.2.0.1/dbhome_1
Oracle user: oracle
Spfile: +DATA/DEV/PARAMETERFILE/spfile.319.1169935561
Password file: +DATA/DEV/PASSWORD/pwddev.269.1169935335
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECO,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: DEV1,DEV2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@hostnode1 ~]$

[oracle@hostnode1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 6 00:35:43 2024

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

Connected to an idle instance.

SQL>
SQL> startup nomount pfile='/u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/initDEV1.ora_backup';
ORACLE instance started.

Total System Global Area 3690987520 bytes
Fixed Size                  8627200 bytes
Variable Size             905972736 bytes
Database Buffers         2768240640 bytes
Redo Buffers                8146944 bytes
SQL>  create spfile='+DATA/DEV/PARAMETERFILE/spfileDEV.ora' from pfile='/u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/initDEV1.ora_backup';

File created.

SQL> shut immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@hostnode1 dbs]$ srvctl modify database -d DEV -spfile '+DATA/DEV/PARAMETERFILE/spfileDEV.ora'

[oracle@hostnode1 dbs]$ srvctl start database -d DEV
[oracle@hostnode1 dbs]$ srvctl status database -d DEV
Instance DEV1 is running on node hostnode1
Instance DEV2 is running on node hostnode2
[oracle@hostnode1 dbs]$


[oracle@hostnode1 dbs]$ . oraenv
ORACLE_SID = [DEV1] ? TEST1
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@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ srvctl status database -d TEST
Instance TEST1 is running on node hostnode1
Instance TEST2 is running on node hostnode2
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ srvctl config database -d TEST
Database unique name: TEST
Database name: TEST
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/TEST/PARAMETERFILE/spfileTEST.ora
Password file: +DATA/TEST/PASSWORD/pwdtest.315.1169935897
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: TEST1,TEST2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

[oracle@hostnode1 dbs]$ srvctl stop database -d TEST

[oracle@hostnode1 dbs]$ env |grep ORA
ORACLE_SID=TEST1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Jun 6 00:57:52 2024
Version 19.17.0.0.0

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

connected to target database (not started)

RMAN> startup mount;

Oracle instance started
database mounted

Total System Global Area    3690985856 bytes

Fixed Size                     8903040 bytes
Variable Size               1191182336 bytes
Database Buffers            2483027968 bytes
Redo Buffers                   7872512 bytes

RMAN> exit
Recovery Manager complete.
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 6 01:00:19 2024
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> set pages 1000 lines 1000
col TIME for a35
col RESTORE_POSQL> SQL> INT_TIME for a30
col NAME for a3SQL> 0
select SCN,DATABASE_INCARNATIOSQL> N#,GUARANTEE_FLASHBACK_DATABASE,TIME,RESTORE_POINT_TIME,NAME,PDB_RESTORE_POINT from v$restore_point;

       SCN DATABASE_INCARNATION# GUA TIME                                RESTORE_POINT_TIME             NAME                   PDB
---------- --------------------- --- ----------------------------------- ------------------------------ ------------------------------ ---
   1565819                     2 YES 26-MAY-24 09.50.46.000000000 AM                                    GRP_1716697245868       NO

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@hostnode1 dbs]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Jun 6 01:00:39 2024
Version 19.17.0.0.0

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

connected to target database: TEST (DBID=2468082526, not open)

RMAN>
RMAN> flashback database to restore point GRP_1716697245868;

Starting flashback at 06-JUN-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 instance=TEST1 device type=DISK

starting media recovery

archived log for thread 1 with sequence 3 is already on disk as file +DATA/TEST/ARCHIVELOG/2024_05_26/thread_1_seq_3.324.1169978063
archived log for thread 2 with sequence 1 is already on disk as file +DATA/TEST/ARCHIVELOG/2024_05_26/thread_2_seq_1.321.1169977865
media recovery complete, elapsed time: 00:00:03
Finished flashback at 06-JUN-24

RMAN>


[oracle@hostnode1 ~]$ cd /u01/app/oracle/diag/rdbms/test/TEST1/trace/
[oracle@hostnode1 trace]$ tail -f alert_TEST1.log
Flashback Media Recovery Start
 Started logmerger process
2024-06-06T01:01:33.460764+05:30
Parallel Media Recovery started with 2 slaves
2024-06-06T01:01:33.613604+05:30
ALTER SYSTEM SET remote_listener='hostscan.localdomain.com:1521' SCOPE=MEMORY SID='TEST1';
2024-06-06T01:01:33.615983+05:30
ALTER SYSTEM SET listener_networks='' SCOPE=MEMORY SID='TEST1';
2024-06-06T01:01:40.947588+05:30
Flashback Media Recovery Log +DATA/TEST/ARCHIVELOG/2024_05_26/thread_1_seq_3.324.1169978063
2024-06-06T01:01:42.005664+05:30
Flashback Media Recovery Log +DATA/TEST/ARCHIVELOG/2024_05_26/thread_2_seq_1.321.1169977865
2024-06-06T01:01:42.372236+05:30
Incomplete Recovery applied until change 1565820 time 05/26/2024 09:50:53
2024-06-06T01:01:42.376499+05:30
Flashback Media Recovery Complete
Completed: RMAN flashback database to before scn 1565820 in incarnation 2

RMAN> shutdown immediate;

database dismounted
Oracle instance shut down

RMAN> exit

Recovery Manager complete.
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ . oraenv
ORACLE_SID = [TEST1] ?
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/12.2.0.1/dbhome_1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@hostnode1 dbs]$
[oracle@hostnode1 dbs]$ env |grep ORA
ORACLE_SID=TEST1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/dbhome_1
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ srvctl config database -d TEST
Database unique name: TEST
Database name: TEST
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/TEST/PARAMETERFILE/spfileTEST.ora
Password file: +DATA/TEST/PASSWORD/pwdtest.315.1169935897
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: TEST1,TEST2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@hostnode1 dbs]$ 

[oracle@hostnode1 dbs]$ /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/srvctl downgrade database -d TEST -oraclehome /u01/app/oracle/product/12.2.0.1/dbhome_1 -targetversion 12.2.0.1.0
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ srvctl config database -d TEST
Database unique name: TEST
Database name: TEST
Oracle home: /u01/app/oracle/product/12.2.0.1/dbhome_1
Oracle user: oracle
Spfile: +DATA/TEST/PARAMETERFILE/spfileTEST.ora
Password file: +DATA/TEST/PASSWORD/pwdtest.315.1169935897
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: TEST1,TEST2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 6 01:05:55 2024

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

Connected to an idle instance.

SQL>
SQL> create pfile from spfile='+DATA/TEST/PARAMETERFILE/spfileTEST.ora';

File created.

SQL> exit
Disconnected
[oracle@hostnode1 dbs]$

[oracle@hostnode1 dbs]$ srvctl modify database -d TEST -spfile ''
[oracle@hostnode1 dbs]$ srvctl config database -d TEST
Database unique name: TEST
Database name: TEST
Oracle home: /u01/app/oracle/product/12.2.0.1/dbhome_1
Oracle user: oracle
Spfile:
Password file: +DATA/TEST/PASSWORD/pwdtest.315.1169935897
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: oinstall
OSOPER group: oinstall
Database instances: TEST1,TEST2
Configured nodes: hostnode1,hostnode2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@hostnode1 dbs]$


[oracle@hostnode1 trace]$ asmcmd -p
ASMCMD [+] > asmcmd -p

ASMCMD [+] > cd +DATA/TEST/PARAMETERFILE
ASMCMD [+DATA/TEST/PARAMETERFILE] > ls -l
Type           Redund  Striped  Time             Sys  Name
PARAMETERFILE  UNPROT  COARSE   JUN 06 01:00:00  Y    spfile.274.1169981285
PARAMETERFILE  UNPROT  COARSE   JUN 06 01:00:00  N    spfileTEST.ora => +DATA/TEST/PARAMETERFILE/spfile.274.1169981285

ASMCMD [+DATA/TEST/PARAMETERFILE] > rm spfile.274.1169981285
ASMCMD [+DATA/TEST/PARAMETERFILE] > ls -l
ASMCMD-8002: entry 'PARAMETERFILE' does not exist in directory '+DATA/TEST/'
ASMCMD [+DATA/TEST/PARAMETERFILE] > 
ASMCMD [+DATA/TEST] > exit
[oracle@hostnode2 dbs]$

[oracle@hostnode1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 6 01:16:49 2024

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

Connected to an idle instance.

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

Total System Global Area 3690987520 bytes
Fixed Size                  8627200 bytes
Variable Size             905972736 bytes
Database Buffers         2768240640 bytes
Redo Buffers                8146944 bytes
SQL> create spfile='+DATA/TEST/PARAMETERFILE/spfileTEST.ora' from pfile='/u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/initTEST1.ora';

File created.

SQL> shut immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@hostnode1 dbs]$
[oracle@hostnode1 dbs]$ cat > initTEST1.ora
spfile='+DATA/TEST/PARAMETERFILE/spfileTEST.ora'

[oracle@hostnode1 dbs]$ pwd
/u01/app/oracle/product/12.2.0.1/dbhome_1/dbs
[oracle@hostnode1 dbs]$

[oracle@hostnode2 dbs]$ cat > initTEST2.ora
spfile='+DATA/TEST/PARAMETERFILE/spfileTEST.ora'

[oracle@hostnode2 dbs]$

[oracle@hostnode1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 6 01:20:13 2024

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 3690987520 bytes
Fixed Size                  8627200 bytes
Variable Size             905972736 bytes
Database Buffers         2768240640 bytes
Redo Buffers                8146944 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@hostnode1 dbs]$
[oracle@hostnode1 dbs]$ srvctl start database -d TEST
[oracle@hostnode1 dbs]$ srvctl status database -d TEST
Instance TEST1 is running on node hostnode1
Instance TEST2 is running on node hostnode2
[oracle@hostnode1 dbs]$

[oracle@hostnode1 ~]$ . oraenv
ORACLE_SID = [TESt1] ? TEST1
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/12.2.0.1/dbhome_1
The Oracle base has been set to /u01/app/oracle
[oracle@hostnode1 ~]$
[oracle@hostnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 6 01:32:38 2024

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


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

SQL> column comp_name format a40
column version format a12
columSQL> SQL> n status format a15
select comp_SQL> name,version,status from dba_registry;

COMP_NAME                                VERSION      STATUS
---------------------------------------- ------------ ---------------
Oracle Database Catalog Views            12.2.0.1.0   VALID
Oracle Database Packages and Types       12.2.0.1.0   VALID
JServer JAVA Virtual Machine             12.2.0.1.0   VALID
Oracle XDK                               12.2.0.1.0   VALID
Oracle Database Java Packages            12.2.0.1.0   VALID
OLAP Analytic Workspace                  12.2.0.1.0   VALID
Oracle Real Application Clusters         12.2.0.1.0   VALID
Oracle XML Database                      12.2.0.1.0   VALID
Oracle Workspace Manager                 12.2.0.1.0   VALID
Oracle Text                              12.2.0.1.0   VALID
Oracle Multimedia                        12.2.0.1.0   VALID

COMP_NAME                                VERSION      STATUS
---------------------------------------- ------------ ---------------
Spatial                                  12.2.0.1.0   VALID
Oracle OLAP API                          12.2.0.1.0   VALID
Oracle Label Security                    12.2.0.1.0   VALID
Oracle Database Vault                    12.2.0.1.0   VALID

15 rows selected.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@hostnode1 ~]$



1 comment:

Running SQL and O/S Commands Within RMAN

Running SQL and O/S Commands Within RMAN Sometimes you may want to run an SQL statement from within RMAN. Use RMAN’s sql command to do this....