Saturday, July 26, 2014

Why all software should have a command line and automation plugin ? Answer is simple - if you have to repeat number of operation for different targets - scripts can help you save your precious time.

I really enjoy a fact that Oracle added a command line to Oracle Enterprise Manager line, and now you can script lot of boring tasks like adding new administrator to list of users who can access Named Credentials.

To add new admin (przepiorom) it's enough to run the following script

add_privs.sh przepiorom

This is first draft of this script (no error handling but it's doing his work)

The next example is an another script which is refreshing a Weblogic domain components.When a new version of application is deployed a previous one are still registered as a targets and you will see it as down in your OEM.

There is a domain refresh command in OEM menu but if you have more systems going through all of those is not what you want. Using a command line and configuration file you can be done with one line.

There is a one line per target split into two parts. First part of line is a target name and domain name, ex. /xxx_soa_mot_domain_soa/soa
Second part is operation: R - remove target which doesn't exist in domain anymore E - enable refresh of domain (aka. add monitoring targets)regards,Marcin

Wednesday, July 16, 2014

There is couple of way to do heterogeneous migration of Oracle databases but staring with 12c there is whole set of new RMAN commands to transport data across different platforms.I was looking for a best method of move tablespaces from HP-UX to Linux and after some research I found this presentation by Martin Bach from Enkitec (you can watch it online here). Martin describing Oracle Perl script (MOS ID 1389592.1) which allows you to convert tablespaces on 11g database including Exadata. At first sigh it looks like a solution for me but to use that script I need to create a new backup of all tablespaces I want to move. That could be an option but I already had a daily updated copy of all data files in FRA. So in next step I started to investigate who script is working and how to convert a backupset from HPUX to Linux and apply incremental backup into files not registered into database. Well solution was easy to predict - use PL/SQL RMAN interface - DBMS_BACKUP_RECOVERY package.

It was not a first time when I was looking into it and it remembered me a Oracle 8i database with corrupted control file without RMAN catalog which had to be recovered. For those who forget RMAN in Oracle 8i had not a catalog functionality so you had to treat all control files or RMAN catalog with extra care. But using knowledge about files and backup names, PL/SQL and DBMS_BACKUP_RECOVERY it was possible to restore everything manually. But let's come back to current problem - I was keen to use PL/SQL but before that I decided to check what new Oracle introduced in 12c and nice surprise - now all operations described used by Oracle perl script are possible from RMAN interface. So in next step I decided to do a little test with existing copies of data files from smallest tablespace called 'USERS'.This small test was successful and now I need to document and describe all steps and this is material for a next post. It's working a little bit better than Oracle script as there is no need to convert backupset - recover can apply and do conversion on the fly

Tuesday, July 1, 2014

What happen when someone will delete Oracle flashback logs ? You probably don't notice it until you will try to flashback database or bounce instance. There is no hope for flashback database without flashback files but there is still way to start your database again without recovery or data loss.Here is a scenario:

OK at least there is some information about root cause - it is looking for missing flashback files.
Information about flashback database is keep inside control file so let's try to recreate control file using trace file

I blogged about that cause I have to solve this problem several time when due to space restriction flashback logs
has been deleted by other DBA manually instead of disabling and enabling flashback on database.
Just keep in mind if you need to release space in FRA don't delete flashback logs manually but turn off flashback on the database