Monday, August 18, 2014

how to check active sessions on SQL server

sp_who
sp_who2 stored procedure used to list the connection and blkby column will indicate that blocked columns

Thursday, January 16, 2014

dba_job is not running in oracle database?

issue:
dba jobs is not running on oracle database and its hanging

solution:
Please check the job queue process parameter value ,it should be equal or more than the no of job running on the database.

Opatch throws error in oracle database

issue:

The java class could not be loaded. java.lang.UnsupportedClassVersionError: (oracle/opatch/OPatch) bad major version at offset=6

OPatch failed with error code 1

solution:
Please use recent Opatch utility to resolve this issue/use recent version of JDK/JRE

Thursday, December 12, 2013

blower issue in netezza appliance

how to find out blower issue in Netezza ?

nzhw -issue

need to replace the blower ,its a kind of cooling system for chasis

Wednesday, November 13, 2013

script to do full restore on Netezza database

2013-08-02 12:55:09.428218 PDT Info: NZ-00022: --- program 'restoresvr' (4080) starting on host 'nsdwt03' ... ---
2013-08-02 12:55:09.454282 PDT Info: Restore command: nzrestore -u admin -db XYZ -sourcedb ABC -dir /netback_old/backup/july -backupset 20130721195736 -npshost VIP
2013-08-02 12:55:09.454302 PDT Info: Setting the command line options
2013-08-02 12:55:09.776227 PDT Info: Restoring from base directory '/netback_old/backup/july'
2013-08-02 12:55:09.776362 PDT Info: Starting the restore process
2013-08-02 12:57:24.888546 PDT Info: Reading locations file
2013-08-02 12:57:25.459500 PDT Info: Warning: Invalid backupset, found /Netezza/VIP.petc.com/ABC/20130721195736/1/FULL in locations.txt, expected /Netezza/VIP/ABC/20130721195736/1/FULL.
2013-08-02 12:57:26.871784 PDT Info: Reading schema from /netback_old/backup/july/Netezza/<VIP>/ABC/20130721195736/1/FULL/md
2013-08-02 12:57:26.872418 PDT Info: Opening pipe for schema read ...
2013-08-02 12:57:27.252432 PDT Info: Restoring a 4.0 backup from NPS Release 6.0.2 (P-1) [Build 17433] created on xs system 'nsdwp01'
2013-08-02 12:57:27.252454 PDT Info: Restore of 92 dataslice backupset to 46 dataslice system
2013-08-02 12:57:27.657741 PDT Info: Operation txid and history table record 2773474
2013-08-02 12:57:27.669672 PDT Info: Restoring schema
2013-08-02 12:58:24.897130 PDT Info: Start restoring the data, compressed format.

script to check standby sync status with primary oracle database?

SET PAGESIZE 124
COL DB_NAME FORMAT A8
COL HOSTNAME FORMAT A12
COL LOG_ARCHIVED FORMAT 999999
COL LOG_APPLIED FORMAT 999999
COL LOG_GAP FORMAT 9999
COL APPLIED_TIME FORMAT A12
SELECT DB_NAME, HOSTNAME, LOG_ARCHIVED, LOG_APPLIED,APPLIED_TIME,
LOG_ARCHIVED-LOG_APPLIED LOG_GAP
FROM
(
SELECT NAME DB_NAME
FROM V$DATABASE
),
(
SELECT UPPER(SUBSTR(HOST_NAME,1,(DECODE(INSTR(HOST_NAME,'.'),0,LENGTH(HOST_NAME),
(INSTR(HOST_NAME,'.')-1))))) HOSTNAME
FROM V$INSTANCE
),
(
SELECT MAX(SEQUENCE#) LOG_ARCHIVED
FROM V$ARCHIVED_LOG WHERE DEST_ID=1 AND ARCHIVED='YES'
),
(
SELECT MAX(SEQUENCE#) LOG_APPLIED
FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND APPLIED='YES'
),
(
SELECT TO_CHAR(MAX(COMPLETION_TIME),'DD-MON/HH24:MI') APPLIED_TIME
FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND APPLIED='YES'
);

script to identify the corrupted block name in oracle database?

select segment_name,segment_type,owner
from sys.dba_extents
where file_id=180
and (133571) between block_id and block_id + blocks -1;

script to list fragmented tables on oracle database schema?

select owner,table_name,round((blocks*8192),2)/1024/1024 "size (MB)" , round((num_rows*avg_row_len/1024/1024),2) "actual_data (MB)",
round((round((blocks*8192),2)/1024/1024 - round((num_rows*avg_row_len/1024/1024),2)),1) "wasted_space (MB)"
from dba_tables where (round((blocks*8192),2)/1024/1024 > round((num_rows*avg_row_len/1024/1024),2))
and (round((round((blocks*8192),2)/1024/1024 - round((num_rows*avg_row_len/1024/1024),2)),1)) > 100 and owner='ABC'
order by 5 desc;

script to compile all invalid object on oracle database?

select 'alter view man.'||object_name||' compile;' from dba_objects where owner='man' and status='INVALID' and object_type='VIEW';

select 'alter package man.'||object_name||' compile body;' from dba_objects where owner='man' and status='INVALID' and object_type='PACKAGE BODY';
select 'alter function man.'||object_name||' compile ;' from dba_objects where owner='man' and status='INVALID' and object_type='FUNCTION';
select 'alter procedure man.'||object_name||' compile ;' from dba_objects where owner='man' and status='INVALID' and object_type='PROCEDURE';
select 'alter view stage.'||object_name||' compile;' from dba_objects where owner='stage' and status='INVALID' and object_type='VIEW';
select 'alter procedure stage.'||object_name||' compile ;' from dba_objects where owner='stage' and status='INVALID' and object_type='PROCEDURE';

scrip to list top 10 hottest object in oracle database

col owner  format a20 trunc
col object_name format a30
col touches  format 9,999,999
select *
from (
 select count(*)
 , sum(tch) TOUCHES
 , u.name OWNER
 , o.name OBJECT_NAME
 from  x$bh x
 , obj$ o
 , user$ u
 where x.obj = o.obj#
 and o.owner# = u.user#
 group  by u.name, o.name
   order by 2 desc
 )
where rownum < 11;