Saturday, May 9, 2020

Oracle Physical Standby Database shutdown and startup

Oracle Physical Standby Database shutdown and startup


Shutdown Physical Standby Database and MRP:

Please execute below on physical standby database to stop the Managed Recovery Process(MRP) and shutdown physical standby database:

# connect / as sysdba
STANDBY> alter database recover managed standby database cancel;
STANDBY> recover standby database until cancel;
auto
STANDBY> shutdown immediate
STANDBY> exit

Startup Physical Standby Database and MRP:

Please execute below commands on physical standby database to start physical standby database and the Managed Recovery Process(MRP) :

# connect / as sysdba
STANDBY> startup nomount
STANDBY> alter database mount standby database;
STANDBY> alter database recover managed standby database disconnect from session;
STANDBY> exit

How to check the database growth

How to check the database growth


SET LINESIZE 200
SET PAGESIZE 200
COL "Database Size" FORMAT a13
COL "Used Space" FORMAT a11
COL "Used in %" FORMAT a11
COL "Free in %" FORMAT a11
COL "Database Name" FORMAT a13
COL "Free Space" FORMAT a12
COL "Growth DAY" FORMAT a11
COL "Growth WEEK" FORMAT a12
COL "Growth DAY in %" FORMAT a16
COL "Growth WEEK in %" FORMAT a16
SELECT
(select min(creation_time) from v$datafile) "Create Time",
(select name from v$database) "Database Name",
ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2) || ' MB' "Database Size",
ROUND((SUM(USED.BYTES) / 1024 / 1024 ) - ROUND(FREE.P / 1024 / 1024 ),2) || ' MB' "Used Space",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.P / 1024 / 1024 )) / ROUND(SUM(USED.BYTES) / 1024 / 1024 ,2)*100,2) || '% MB' "Used in %",
ROUND((FREE.P / 1024 / 1024 ),2) || ' MB' "Free Space",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - ((SUM(USED.BYTES) / 1024 / 1024 ) - ROUND(FREE.P / 1024 / 1024 )))/ROUND(SUM(USED.BYTES) / 1024 / 1024,2 )*100,2) || '% MB' "Free in %",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.P / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile),2) || ' MB' "Growth DAY",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.P / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)/ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2)*100,3) || '% MB' "Growth DAY in %",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.P / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)*7,2) || ' MB' "Growth WEEK",
ROUND((((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.P / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)/ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2)*100)*7,3) || '% MB' "Growth WEEK in %"
FROM    (SELECT BYTES FROM V$DATAFILE
UNION ALL
SELECT BYTES FROM V$TEMPFILE
UNION ALL
SELECT BYTES FROM V$LOG) USED,
(SELECT SUM(BYTES) AS P FROM DBA_FREE_SPACE) FREE
GROUP BY FREE.P;

How to check FRA location and it's utilization in Oracle

How to check FRA location and it's utilization in Oracle


set linesize 500
col NAME for a50
select name, ROUND(SPACE_LIMIT/1024/1024/1024,2) "Allocated Space(GB)",
round(SPACE_USED/1024/1024/1024,2) "Used Space(GB)",
round(SPACE_RECLAIMABLE/1024/1024/1024,2) "SPACE_RECLAIMABLE (GB)" ,
(select round(ESTIMATED_FLASHBACK_SIZE/1024/1024/1024,2)
from V$FLASHBACK_DATABASE_LOG) "Estimated Space (GB)"
from V$RECOVERY_FILE_DEST;

How to check installed components and options in Oracle

How to check installed components and options in Oracle


To check which components are installed in a database:
SELECT * FROM DBA_REGISTRY;

To check which options are enabled:
SELECT * FROM V$OPTION;

To check which features are used:
SELECT * FROM DBA_FEATURE_USAGE_STATISTICS;

How to check core CPU's

How to check core CPU's



Command to check CPU info on Linux
cat /proc/cpuinfo|grep processor|wc -l

OR
getconf _NPROCESSORS_ONLN

Command to check CPU info on Solaris
psrinfo -v|grep "Status of processor"|wc -l

Command to check CPU info on AIX
lsdev -C|grep Process|wc -l

Command to check CPU info on HP/UX
ioscan -C processor | grep processor | wc -l

Saturday, May 2, 2020

RSYNC Usage Examples

RSYNC Usage Examples


An Example:  this will replicate the directory mqmrsynctest located on the local machine rac1 to the remote machine rac2

oracle@rac1 backup]$ rsync -avzh ./MQMRSYNCTEST oracle@rac2:/home/oracle/backup
oracle@rac2's password:
sending incremental file list
MQMRSYNCTEST/
MQMRSYNCTEST/mqmtest
MQMRSYNCTEST/test1
MQMRSYNCTEST/test10
MQMRSYNCTEST/test2
MQMRSYNCTEST/test3
MQMRSYNCTEST/test4
MQMRSYNCTEST/test5
MQMRSYNCTEST/test6
MQMRSYNCTEST/test7
MQMRSYNCTEST/test8
MQMRSYNCTEST/test9
MQMRSYNCTEST/test01/
MQMRSYNCTEST/test02/
MQMRSYNCTEST/test03/
MQMRSYNCTEST/test04/
MQMRSYNCTEST/test05/
MQMRSYNCTEST/test06/
MQMRSYNCTEST/test07/
MQMRSYNCTEST/test08/
MQMRSYNCTEST/test09/

sent 1.21K bytes  received 267 bytes  423.14 bytes/sec
total size is 1.20K  speedup is 0.81

[oracle@rac2 MQMRSYNCTEST]$ ls -l
total 40
-rw-r--r-- 1 oracle oinstall 1200 May  2 15:16 mqmtest
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test01
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test02
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test03
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test04
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test05
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test06
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test07
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:17 test08
drwxr-xr-x 2 oracle oinstall 4096 May  2 15:18 test09
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test1
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test10
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test2
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test3
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test4
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test5
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test6
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test7
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test8
-rw-r--r-- 1 oracle oinstall    0 May  2 15:17 test9
[oracle@rac2 MQMRSYNCTEST]$


RSYNC FAQ's

1. Is Rsync replication encrypted?  -----   
Yes it can be, for example you could use rsync in conjunction with ssh : rsync -avzhe ssh oracle@rac1:/home/oracle//MQMRSYNCTEST /home/oracle/

2. In case of disconnection, will Rsync resend the package without any loss of data 
You would need to initiate another rsync operation to continue syncing the folders

3. Can Rsync be used with separate Ethernet on a private network? 
any TCP based network connection will work

4. Will Rsync affect the Server performance ?
Execution of any additional command will impact a machines performed,  whether it impacts performance to the point others notice it would be dependent on the to many variables to give you a definitive answer.  What volume of information is being read on the node and written to the receiving node, what are the specs of the machines involved, how fast is the network, how fast is the storage involved etc etc...

Note the rsync commands here have been implemented through a linux environment, they may differ across the unix variants.