Saturday 29 May 2021

Manage OCI Exadata database and listener using dbaascli

Stop/start/bounce db using dbaascli

[root@ociexavm-qsea1 exadbcpatchmulti]# dbaascli database status --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command database status

Database Status:

Instance testdb21 is running on node ociexavm-qsea1. Instance status: Open.

Instance testdb22 is running on node ociexavm-qsea2. Instance status: Open.

Database name: testdb2

Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production

stop database:

[root@ociexavm-qsea1]# dbaascli database stop --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command database stop

Database stopped!

[root@ociexavm-qsea1]# dbaascli database status --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command database status

Database Status:

Instance testdb21 is not running on node ociexavm-qsea1

Instance testdb22 is not running on node ociexavm-qsea2

start database:

[root@ociexavm-qsea1]# dbaascli database start --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command database start

Database started!

[root@ociexavm-qsea1]# dbaascli database status --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command database status

Database Status:

Instance testdb21 is running on node ociexavm-qsea1. Instance status: Open.

Instance testdb22 is running on node ociexavm-qsea2. Instance status: Open.

Database name: testdb2

Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production

Bounce database:

[root@ociexavm-qsea1 exadbcpatchmulti]# dbaascli database bounce --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command database bounce

Database stopped!

Database started! 

Manage Listener using dbaascli:

[root@ociexavm-qsea1]# dbaascli listener status --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command listener status

Geting listener status

Listener LISTENER is enabled

Listener LISTENER is running on node(s): ociexavm-qsea2,ociexavm-qsea1

[root@ociexavm-qsea1]# dbaascli listener bounce --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command listener bounce

Bouncing listener

Stoping listener

Listener stopped!

Starting listener

Listener started!

[root@ociexavm-qsea1]# dbaascli listener stop --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command listener stop

Stoping listener

Listener stopped!

[root@ociexavm-qsea1]# dbaascli listener status --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command listener status

Geting listener status

Listener LISTENER is enabled

Listener LISTENER is not running

[root@ociexavm-qsea1]# dbaascli listener start --dbname testdb2

DBAAS CLI version 21.1.1.2.0

Executing command listener start

Starting listener

Listener started!

dbhome info:

[root@ociexavm-qsea1]# dbaascli dbhome info

DBAAS CLI version 21.1.1.2.0

Executing command dbhome info

Enter a homename or just press enter if you want details of all homes

1.HOME_NAME=OraHome100

  HOME_LOC=/u02/app/oracle/product/19.0.0.0/dbhome_2

  VERSION=19.10.0.0

  PATCH_LEVEL=19.10.0.0

  DBs installed=qetestdb testdb2 testdb1 testdb3

   Agent DB IDs=-------------------------

 OH Backup=NOT Configured

Friday 14 May 2021

Flashback table to before drop

flashback table helps us to restore table to before state in case of human or application error


SQL> select * from table1;


       SNO NAME                  SAL DOB             HIREDATE

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

         1 Jay                  2000 19850601.000000 20151111.000000


SQL> drop table table1;


Table dropped.


SQL> select * from table1;

select * from table1

              *

ERROR at line 1:

ORA-00942: table or view does not exist


Check recycle bin:

SQL> SELECT object_name, droptime FROM user_recyclebin  WHERE original_name = 'TABLE1';


OBJECT_NAME                        DROPTIME

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

BIN$5iiyOpVyZ6LgU6s4EKx1Iw==$0     2021-05-13:16:28:54


Restore table:

SQL> flashback table table1 to before drop;

Flashback complete.


SQL> select * from table1;

       SNO NAME                  SAL DOB             HIREDATE

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

         1 Jay                  2000 19850601.000000 20151111.000000



We can also flashback  table using scn , time stamp

FLASHBACK TABLE table1 TO SCN scn_value; 

FLASHBACK TABLE table1 TO TIMESTAMP TO_TIMESTAMP('Date', 'YYYY-MM-DD HH:MI:SS');