Google+ Followers

Pages

Thursday, September 27, 2012

Check RMAN command / script syntax


 check syntax for RMAN commands without running the RMAN.
Example: Checking syntax of commands on the command line.


$ rman checksyntax


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


RMAN> backup database;
The command has no syntax errors

RMAN> exit

Example: Checking syntax of commands on the command script.

$ cat backup.txt

connect target /
connect catalog rmancatalog/rmancatlog@catalog
run {
backup database;
}


$ rman checksyntax @backup.txt


Recovery Manager: Release 10.2.0.1.0 – Production on Sun Nov 30 09:31:51 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.


RMAN> connect target *
2> connect catalog *
3>
4> run {
5> backup database;
6> }
7>
The cmdfile has no syntax errors


Recovery Manager complete.


Verify Database 32/64 bit creation


to check  database been created originally in a 32-bit environment and is now on a 64-bit platform


select decode(instr(metadata, 'B023'),
              0,
              '64bit Database',
              '32bit Database') "DB Creation"
  from kopm$;



Saturday, September 8, 2012

DB Buffer Usage Query


-- DB Buffer Usage


select decode(state,
            0, 'Free',
            1, decode(lrba_seq, 0, 'Available', 'Being Modified'),     
            2, 'Not Modified',
            3, 'Being Read',
               'Other') block_status,
            count(*) "count"
from sys.x$bh
group by decode(state,
            0, 'Free',
            1, decode(lrba_seq, 0, 'Available', 'Being Modified'),     
            2, 'Not Modified',
            3, 'Being Read',
       'Other');



CPU USAGE BY current Users


--- CPU USAGE BY USER


        SELECT s.sid,
     s.serial#,
     nvl(s.username, '[ORACLE PROCESS]') user_name,
     s.osuser os_user,
     k.ksusestv cpu_usage,
     s.program,
     s.client_info,
     s.module,
     s.machine,
     s.action,
     s.logon_time
FROM v$session s,
     sys.x$ksusesta k
WHERE k.indx = s.sid
      AND k.ksusestn = 12
  AND s.type != 'BACKGROUND'
ORDER BY k.ksusestv DESC