Sunday, August 20, 2023

Recover tablespace from RMAN Backup

 

Before recovering tablespace, first validate database backup availability

RMAN> RESTORE DATABASE PREVIEW SUMMARY UNTIL TIME "to_date('05/22/21 18:34:00','mm/dd/yy hh24:mi:ss')";







……………





If it says that you have all the backup available then you can proceed with the tablespace recovery

RMAN> recover tablespace "TEST1" until time "to_date('05/22/21 18:34:00','mm/dd/yy hh24:mi:ss')" auxiliary destination '+DATA_INF';








……………








……………..











Put the tablespace online after complete recovery and validate its availability and the tables in it


















Recover table from RMAN Backup

Before recovering table, first validate database backup availability

RMAN> RESTORE DATABASE PREVIEW SUMMARY UNTIL TIME "to_date('05/21/21 18:34:00','mm/dd/yy hh24:mi:ss')";








………









If it says that you have all the backup available then you can proceed with the table recovery

RMAN> run {

recover table "VPSRIVA_RO"."VP_TEST1" UNTIL TIME "to_date('05/21/21 18:34:00','mm/dd/yy hh24:mi:ss')"

auxiliary destination '+DATA_INF';

}










……..



 









Validate the recovered table




Thursday, January 10, 2019

Space not released after deletion of file on server

You can follow below steps from root user to clear the space if it gets stuck at kernel level


lsof +L | grep deleted
## it will show the process id, here it gave process id 21099

cd /proc/<process_id>/fd ## go to process id directory like below


cd /proc/21099/fd
l-wx------ 1 root root 64 Apr  1  2016 30 -> /u00/app/grid/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log_bkup1Aug17 (deleted)
## it will show a link with some number to delete file which is still holding the space


> 30 ##then truncate the file like this, mention the number here with >

It will clear the deleted space

Tuesday, November 13, 2018

RAC crsctl commands

For checking SYNTAX of any crsctl command on server - type command crsctl and then enter

>> crsctl commands to be run by root user
If you want to know the GRID home location, just do
ps -ef | grep d.bin >> You will find the cluster running processes GRID HOME location

crsctl stop crs >> Stop cluster on local node
crsctl start crs >> Start cluster on local node

crsctl stop cluster -all >> To stop cluster on all nodes part of cluster, OHASD will be running only and can be stopped by below command on all nodes

crsctl stop has >> To stop HAS on local node

crsctl enable crs >> ENABLE autostart of cluster after server reboot
crsctl disable crs >> DISABLE autostart of cluster after server reboot


>> Below commands can be run by root / grid owner

crsctl check crs >> To see CRS status on local node
crsctl check cluster -all >> To see cluster status on all the nodes part of Cluster

crsctl stat res -t >> To see all cluster resource status
crsctl stat res <<resource_name>> -t >> To see status of specific resource
crsctl query cssvotedisk >> To see the voting file details
ocrcheck >> To check the OCR location
ocrconfig -showbackup >> To show backup status of OCR
ocrconfig -manualbackup >> To take manual backup of OCR



Below commands to be used to adding / modifying resource of cluster
crsctl add resource -help
crsctl modify resource -help


We can use below command to see the detailed attributes of resource

crsctl stat res <<resource_name>> -p

Wednesday, November 7, 2018

RMAN Catalog de-register unused database

Below are the steps of one method that you can use to remove old db entries from RMAN catalog database.

+++++++++++++++++++++++++++++
oracle@target2300:~> sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 5 02:09:26 2018

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


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

SQL> -- connect to RMAN Catalog user
SQL> connect rman/backup
Connected.
SQL> SELECT db_key, dbid, name FROM rc_database WHERE name = 'TestingDBA';

    DB_KEY       DBID NAME
---------- ---------- --------
   1450377 1874538921 TestingDBA
   3256317 1885700034 TestingDBA
  28091447 1903574000 TestingDBA
  28805999 1903892800 TestingDBA

SQL>  SELECT db_key, dbid, name FROM rc_database WHERE name like 'TestingDB%';

    DB_KEY       DBID NAME
---------- ---------- --------
  41927688  826894727 TestingDBBETA
   1450377 1874538921 TestingDBA
   3256317 1885700034 TestingDBA
  28091447 1903574000 TestingDBA
  34396606 3955608007 TestingDBALFA
  34400693 1392119613 TestingDBBETA
  28805999 1903892800 TestingDBA

7 rows selected.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1450377,1874538921);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(3256317,1885700034);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(28091447,1903574000);

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(28805999,1903892800);

PL/SQL procedure successfully completed.

SQL> SELECT db_key, dbid, name FROM rc_database WHERE name like 'TestingDB%';

    DB_KEY       DBID NAME
---------- ---------- --------
  41927688  826894727 TestingDBBETA
  34396606 3955608007 TestingDBALFA
  34400693 1392119613 TestingDBBETA