Change passwords in Oracle with Python

Write the contents out to a CSV file import sys import cx_Oracle import os def printf (format,*args): sys.stdout.write (format % args) def printException (exception): error, = exception.args printf (“Error code = %s\n”,error.code); printf (“Error message = %s\n”,error.message); username = sys.argv[1] password = sys.argv[2] databaseName = sys.argv[3] new_user = sys.argv[4] new_password = sys.argv[5] print(‘Connecting to ‘ … Read more

How to convert an instance to a cluster database

I have tried to perform this using Enterprise Manager, however I have never been successful. Here are the manual steps. Migrating a database from one RAC system to another can be performed by cloning the database, once it’s cloned it can be converted to a cluster database. The following steps are what is required. Step … Read more

Truncate sys.aud$ table

How to reclaim space from system Solution Step 1. Check to see what is the lagest table in the system tablespace SELECT * FROM ( SELECT OWNER, SEGMENT_NAME, BYTES / 1024 / 1024 MB FROM DBA_SEGMENTS WHERE SEGMENT_TYPE = ‘TABLE’ ORDER BY BYTES / 1024 / 1024 DESC) WHERE ROWNUM

Database Capacity Planning

Capacity and Growth Forecast How to estimate the growth and forecast of a database on a host. Step-by-step guide The procedure is at the bottom of this article. Login to enterprise manager from sqlplus (from omsdbaup03) oracle@omsdbaup03:/users/oracle [emrep12c] $ sqlplus sysman/xxxxxx 2. Follow the following to calculate growth for each database on a host SQL> … Read more

Everything RAC – Cheat Sheet

The is to guide you through the Oracle RAC clustered system CRSCTL Command Note: -Any command which just needs to query information can be run using oracle user. But anything which alters Oracle Clusterware requires root privileges. First set oracle environment to CRS Start Oracle Clusterware UNIX>crsctl start crs Stop Oracle Clusterware UNIX>crsctl stop crs … Read more

Purge Oracle Maintenance Logs

Purging Oracle Logs The basis of this script is to purge logs from the Oracle Base directory daily The script will be executed from cron on a daily basis, however this could run at different times on each system due to business and or system load requirements. Technical Steps #!/bin/ksh #——————————————————————————– #– #– File name: … Read more

Missing Optimizer Statistics

ELECT ‘TABLE’ object_type, owner, table_name object_name, last_analyzed, stattype_locked, stale_stats FROM all_tab_statistics WHERE (last_analyzed IS NULL OR stale_stats = ‘YES’) AND stattype_locked IS NULL AND owner NOT IN (‘ANONYMOUS’, ‘CTXSYS’, ‘DBSNMP’, ‘EXFSYS’, ‘LBACSYS’, ‘MDSYS’, ‘MGMT_VIEW’, ‘OLAPSYS’, ‘OWBSYS’, ‘ORDPLUGINS’, ‘ORDSYS’, ‘OUTLN’, ‘SI_INFORMTN_SCHEMA’, ‘SYS’, ‘SYSMAN’, ‘SYSTEM’, ‘TSMSYS’, ‘WK_TEST’, ‘WKSYS’, ‘WKPROXY’, ‘WMSYS’, ‘XDB’) AND owner NOT LIKE ‘FLOW%’ UNION … Read more

Disk IO_WAIT

SELECT target_name, round(avg(average),2) FROM mgmt$metric_daily WHERE column_label = ‘Total Disk I/O made across all disks (per second)’ AND rollup_timestamp >= sysdate-14 AND rollup_timestamp <= sysdate group by target_name order by 2 desc; Up to 2000 is low (normal) Between 2000-5000 is busy over 5000 is high over 10000 is extreme

What Objects are in Use

SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,S.USERNAME, S.MACHINE,S.PORT , S.LOGON_TIME,SQ.SQL_FULLTEXT FROM V$LOCKED_OBJECT L, DBA_OBJECTS O, V$SESSION S, V$PROCESS P, V$SQL SQ WHERE L.OBJECT_ID = O.OBJECT_ID AND L.SESSION_ID = S.SID AND S.PADDR = P.ADDR AND S.SQL_ADDRESS = SQ.ADDRESS;