Labels

Monday, 24 July 2017

How to install Oracle on Linux environment

I have done Oracle 11g installation on Linux environment by creating VM on windows laptop. Below are the steps as well as screen shots to install Oracle step by step.

[root@myoracle ~]# groupadd oinstall
[root@myoracle ~]# groupadd dba
[root@myoracle ~]# useradd -g oinstall -G dba oracle
[root@myoracle ~]# cd /u01
[root@myoracle u01]# ls -ltr
[root@myoracle ~]# ls -ltr /u01
[root@myoracle ~]# chown -R oracle:ointall /u01
[root@myoracle ~]# chmod 775 /u01
[root@myoracle ~]# ls -lrt /u01
[root@myoracle u01]# passwd oracle
[root@myoracle ~]# su - oracle
[root@myoracle ~]# cd /mnt/hgfs
[root@myoracle hgfs]# cd database/
[root@myoracle ~]# cd /opt
[root@myoracle ~]# ls -ltr
[root@myoracle ~]# chown -R oracle:oinstall /opt
[root@myoracle ~]# chown -R oracle:oinstall /disk1
[root@myoracle ~]# chown -R oracle:oinstall /disk2
[root@myoracle ~]# su - oracle
[root@myoracle ~]# cd /mnt/hgfs
[root@myoracle hgfs]# cd database/
[root@myoracle database]# unzip P1339067_112040_Linux-x86-64_lof7.zip -d/opt
[root@myoracle database]# unzip P1339067_112040_Linux-x86-64_2of7.zip -d/opt
[root@myoracle database]#cd /opt
[root@myoracle opt]#cd database
[root@myoracle database]#ls
In new terminal type xhost +
again in old terminal
[root@myoracle opt]# sh runInstaller

After installation completes you need to run the below script in new terminal under root user.

[root@myoracle ~]# /u01/app/oraInventory/orainstRoot.sh
[root@myoracle ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
































Saturday, 22 July 2017

Thursday, 20 July 2017

T-SQL scripts to monitor Logshipping in SQL Server

--RETURNS A RESULT SET CONTAINING STATUS AND OTHER INFORMATION FOR REGISTERED PRIMARY AND SECONDARY DATABASES ON A PRIMARY, SECONDARY, OR MONITOR SERVER.
EXEC SP_HELP_LOG_SHIPPING_MONITOR

--GET LOG SHIPPING SQL JOBS
SELECT *
FROM MSDB.DBO.SYSJOBS
WHERE CATEGORY_ID = 6

--LOG SHIPPING: GET SQL JOB HISTORY: COPY JOB (INCLUDE YOUR JOBID)
SELECT MSDB.DBO.AGENT_DATETIME(RUN_DATE, RUN_TIME) AS 'RUNDATETIME'
 ,*
FROM MSDB.DBO.SYSJOBHISTORY
WHERE JOB_ID = 'D74C0F28-8626-4FD2-AA8F-72D00DCF5FDD'
 --UNCOMMENT TO GET ONLY THE LAST RUN HISTORY
 AND MSDB.DBO.AGENT_DATETIME(RUN_DATE, RUN_TIME) = (
  SELECT TOP 1 MSDB.DBO.AGENT_DATETIME(RUN_DATE, RUN_TIME) AS 'RUNDATETIME'
  FROM MSDB.DBO.SYSJOBHISTORY
  WHERE JOB_ID = 'D74C0F28-8626-4FD2-AA8F-72D00DCF5FDD'
  ORDER BY RUNDATETIME DESC
  )
ORDER BY RUNDATETIME DESC
 ,INSTANCE_ID DESC

--EXEC MSDB.DBO.SP_HELP_JOBHISTORY @JOB_NAME = N'LS_COPY_XYZ' ; 
--GET LAST RUN HISTORY: RESTORE JOB (INCLUDE YOUR JOBID)
SELECT MSDB.DBO.AGENT_DATETIME(RUN_DATE, RUN_TIME) AS 'RUNDATETIME'
 ,*
FROM MSDB.DBO.SYSJOBHISTORY
WHERE JOB_ID = 'E19D351F-22B8-4624-A8A2-102C094D5E84'
 --UNCOMMENT TO GET ONLY THE LAST RUN HISTORY
 AND MSDB.DBO.AGENT_DATETIME(RUN_DATE, RUN_TIME) = (
  SELECT TOP 1 MSDB.DBO.AGENT_DATETIME(RUN_DATE, RUN_TIME) AS 'RUNDATETIME'
  FROM MSDB.DBO.SYSJOBHISTORY
  WHERE JOB_ID = 'E19D351F-22B8-4624-A8A2-102C094D5E84'
  ORDER BY RUNDATETIME DESC
  )
ORDER BY RUNDATETIME DESC
 ,INSTANCE_ID DESC

--EXEC MSDB.DBO.SP_HELP_JOBHISTORY @JOB_NAME = N'LS_RESTORE_XYZ'; 
--STORES ALERT JOB ID
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_MONITOR_ALERT

--STORES ERROR DETAIL FOR LOG SHIPPING JOBS
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_MONITOR_ERROR_DETAIL

--STORES HISTORY DETAILS FOR LOG SHIPPING JOBS (AGENT SESSION DETAILS)
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_MONITOR_HISTORY_DETAIL
ORDER BY LOG_TIME DESC

--STORES ONE MONITOR RECORD PER PRIMARY DATABASE IN EACH LOG SHIPPING CONFIGURATION 
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_MONITOR_PRIMARY

--STORES ONE MONITOR RECORD PER SECONDARY DATABASE IN A LOG SHIPPING CONFIGURATION
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_MONITOR_SECONDARY

--STORES ONE RECORD FOR THE PRIMARY DATABASE IN A LOG SHIPPING CONFIGURATION
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_PRIMARY_DATABASES;

--STORES ONE RECORD PER SECONDARY DATABASE IN A LOG SHIPPING CONFIGURATION
SELECT *
FROM MSDB.DBO.LOG_SHIPPING_SECONDARY_DATABASES;