Posts

Import tables with data pump

You can import specific tables with data pump by using the TABLES parameter . impdp user/pwd directory=MY_DIR dumpfile=export.dmp logfile=import.log tables=schema1.table_name1,schema2.table_name2

Use data pump to extract a package from a dump file

Here's the only method I've found for using Data Pump to extract a package from a dump file.  You don't actually import it directly to a database.  Impdp creates a sql file with the source code for re-creating the package. impdp username/password directory=MYDIR dumpfile=export.dmp sqlfile=mysql.sql This will get all the source code for every package in your dump file.

How to view the contents of a tar file

Q:  How do I view the contents of a tar file? A:  tar -tvf myfile.tar

How to import schemas using datapump

Using datapump to import one or more schemas in an Oracle database is very easy. dpimp user/password dumpfile=file.dmp schemas=SCOTT,USER2 directory=DMP_DIR

Auditing user logon and logoff in Oracle

To track when a user logs on or off Oracle, enable auditing and audit CONNECT in your database.  Then you can query DBA_AUDIT_TRAIL to find logon and logoff info. alter session SET NLS_DATE_FORMAT = 'DD-MM-YYYY HH24:MI:SS'; select username, action,action_name,timestamp,logoff_time from dba_audit_trail where action_name = 'LOGON' and username = '&user'; Here are some more helpful links: http://itechshare.blogspot.com/2010/06/oracle-how-to-track-logon-logout-in.html http://itechshare.blogspot.com/2010/06/oracle-why-dbaaudittrail-shows-more.html

RMAN backups, archive logs, and Oracle Streams - proper backup and keeping in synch

If you have Streams configured in your Oracle database environment, you probably know that RMAN is "Streams aware", meaning, it knows which archive logs Streams still needs and won't remove those from disk once backed up. There are however RMAN commands that will remove archive logs even if they're still needed by Streams. The problem I encountered the other day was with this RMAN command to backup my archive logs, which I run every 15 minutes: run { backup archivelog all delete input; } My archive logs were removed from disk after being backed up, but not if needed by Streams.  The problem was my backup files were getting cumulatively larger throughout the day, because every time it ran, RMAN backed up every archive log still on disk.  This quickly filled the disk. I only wanted to backup archive logs that had not already been backed up, so I tried this: run { backup archivelog all not backed up 1 times delete input; }  My archive backups were no...

Manually run AWR report

Here's a great resource for running Oracle's AWR report manually from the SQL prompt. http://oraclefunda.wordpress.com/2009/10/29/how-to-create-awr-report-manually/