Tuesday, January 8, 2013

Shell Scripting of Deleting Archivelog on Standby / Dataguard Server


Frist Create file vi rman_script.sh

then add the following lines in rman_script.sh file

rman msglog " now.log " <<EOF
connect target /;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
run {
CROSSCHECK BACKUP;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
delete noprompt archivelog until time 'SYSDATE-2';
crosscheck archivelog all;
}
Exit;
EOF

Note:- It will delete all the archive of 48 hours back. (SYSDATE-2) mean 48 Hours Past.

then save it and exit

then give the executing permission to rman_script.sh
chmod 777 rman_script.sh



now run the command 
crontab -e
and add the file in crontab ( Automatically Running Job )

00 6 * * *  "/u01/app/oracle/product/rman_script.sh" 

save it and exit and enjoy!!!!!


Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.

Wednesday, January 2, 2013

OCM 11g Exams Summary


OCM exam a total of nine section, specific arrangements are as follows


First day:
section 0: Creating a database 45 minutes
section 1: the database and network configuration 120 minutes
section 2: Gridcontrol Installation and Configuration 120 minutes
section 3: a database backup and recovery 60 minutes
section 4: Data Warehouse Management 90 minutes
The next day:
section 5: Database Management 120 minutes
section 6: Database Performance Management 120 minutes
section 7: the deployment of Oracle RAC Database 105 minutes
sectoin 8: Deployment dataguard Database 60 minutes

Failure in execution (rc=-1, 0, No such file or directory)


for command /u01/app/11.2.0/grid/bin/crsctl query crs activeversion



CRS is already configured on this node for crshome=/u01/app/11.2.0/grid
Cannot configure two CRS instances on the same cluster.


Please deconfigure before proceeding with the configuration of new home.

[root@dr ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -

I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl


SOLUTION:- cd /etc/oracle  
remove ocr.loc.orig  olr.loc.orig and ocr.loc   olr.loc  files.  then retry and ENJOY!!!!!


Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
User ignored Prerequisites during installation
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node dr successfully pinned.
Adding Clusterware entries to inittab

dr     2013/01/02 11:47:18     /u01/app/11.2.0/grid/cdata/dr/backup_20130102_114718.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server



Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.

Tuesday, December 11, 2012

Error: The Virtualization capability of your processor is already in use????

Error: The Virtualization capability of your processor is already in use????



The virtualization capability of your processor is already in use. Disable any other running hypervisors before running VMware Workstation."

then: "Failed to initialize monitor device."

then: "Unable to change virtual machine power state: Cannot find a valid peer process to connect to."

With Workstation 1 and 2 , I was getting someting like: "RunVM failed, operation not permitted", and: "Unable to change virtual machine power state: Cannot find a valid peer process to connect to."



Dont worry

Solution :-

PS: Someone not daring to uninstall kvm might try to run VMware Server after removing the kvm modules from the kernel runtime:

[root@testdb ~]# lsmod | grep kvm
kvm_intel              85256  0
kvm                   225824  2 ksm,kvm_intel
[root@testdb ~]# modprobe -rv kvm_intel
rmmod /lib/modules/2.6.18-308.el5/extra/kmod-kvm/kvm-intel.ko

[root@testdb ~]# rmmod kvm


Then retry and Enjoy !!!!!!


Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.

Monday, December 10, 2012

How to INSTALL / DEINSTALL VMWARE Tools from Linux

Download Vmware Tools or RPM

Procedure Number 01
tar -zxf VMware-server-1.0.6-91891.tar.gz

then it will create the folder of vmware-server-distrib
then go to vmware-server-distrib
./vmware-install.pl

Press enter > enter > enter > enter .............. and then enjoy !!!!!


Procedure Number 02

If you are using RPM of VMWare Version 2 or Greater Than then use the following method

rpm -ivh VMware-server-2.0.2-203138.x86_64.rpm

then go to cd /usr/bin   directory and the run the following command
./vmware-config.pl

then Press Enter > enter > enter > ............ and then enjoy !!!

If any one required the CD Key so please contact me at salmanbinmuhammad1982@hotmail.com



Now Run the following Command.


/usr/bin/vmware-uninstall.pl



Note:- Some time you will face the following Error:-

                                                             Error Number 01


A previous installation of VMware software has been detected.

The previous installation was made by the tar installer (version 3).

Keeping the tar3 installer database format.

Error: Unable to execute "/usr/bin/vmware-uninstall.pl.

Failure

Execution aborted.


                                                                Error Number 02

sudo: vmware-uninstall.pl: command not found


So dont worry about it .

Solution is following:-

sudo rm -R /etc/vmware

and Enjoy



Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.

Sunday, December 9, 2012

Renaming and Relocating Oracle Datafiles

Renaming and Relocating Oracle Datafiles

You can rename datafiles to either change their names or relocate them. Some possible procedures for doing this are described in the following sections:
When you rename and relocate datafiles with these procedures, only the pointers to the datafiles, as recorded in the database control file, are changed. The procedures do not physically rename any operating system files, nor do they copy files at the operating system level. Renaming and relocating datafiles involves several steps. Read the steps and examples carefully before performing these procedures.

Procedures for Renaming and Relocating Datafiles in a Single Tablespace
The section suggests some procedures for renaming and relocating datafiles that can be used for a single tablespace. You must have ALTER TABLESPACEsystem privileges.
See Also:
"Taking Tablespaces Offline" for more information about taking tablespaces offline in preparation for renaming or relocating datafiles


Procedure for Renaming Datafiles in a Single Tablespace
To rename datafiles in a single tablespace, complete the following steps:
  1. Take the tablespace that contains the datafiles offline. The database must be open.
    For example:
    ALTER TABLESPACE users OFFLINE NORMAL;
    
  2. Rename the datafiles using the operating system.
  3. Use the ALTER TABLESPACE statement with the RENAME DATAFILE clause to change the filenames within the database.
    For example, the following statement renames the datafiles /u02/oracle/rbdb1/user1.dbf and /u02/oracle/rbdb1/user2.dbfto/u02/oracle/rbdb1/users01.dbf and /u02/oracle/rbdb1/users02.dbf, respectively:
    ALTER TABLESPACE users
        RENAME DATAFILE '/u02/oracle/rbdb1/user1.dbf',
                        '/u02/oracle/rbdb1/user2.dbf'
                     TO '/u02/oracle/rbdb1/users01.dbf', 
                        '/u02/oracle/rbdb1/users02.dbf';
    
    Always provide complete filenames (including their paths) to properly identify the old and new datafiles. In particular, specify the old datafile name exactly as it appears in the DBA_DATA_FILES view of the data dictionary.
  4. Back up the database. After making any structural changes to a database, always perform an immediate and complete backup.


Procedure for Relocating Datafiles in a Single Tablespace
Here is a sample procedure for relocating a datafile.
Assume the following conditions:
  • An open database has a tablespace named users that is made up of datafiles all located on the same disk.
  • The datafiles of the users tablespace are to be relocated to different and separate disk drives.
  • You are currently connected with administrator privileges to the open database.
  • You have a current backup of the database.
Complete the following steps:
  1. If you do not know the specific file names or sizes, you can obtain this information by issuing the following query of the data dictionary viewDBA_DATA_FILES:
    SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES
      2> WHERE TABLESPACE_NAME = 'USERS';
    
    FILE_NAME                                  BYTES
    ------------------------------------------ ----------------
    /u02/oracle/rbdb1/users01.dbf              102400000
    /u02/oracle/rbdb1/users02.dbf              102400000
    
  2. Take the tablespace containing the datafiles offline:
    ALTER TABLESPACE users OFFLINE NORMAL;
    
  3. Copy the datafiles to their new locations and rename them using the operating system. You can copy the files using the DBMS_FILE_TRANSFERpackage discussed in "Copying Files Using the Database Server".
    Note:
    You can temporarily exit SQL*Plus to execute an operating system command to copy a file by using the SQL*Plus HOST command.
  4. Rename the datafiles within the database.
    The datafile pointers for the files that make up the users tablespace, recorded in the control file of the associated database, must now be changed from the old names to the new names.
    Use the ALTER TABLESPACE...RENAME DATAFILE statement.
    ALTER TABLESPACE users
        RENAME DATAFILE '/u02/oracle/rbdb1/users01.dbf',
                        '/u02/oracle/rbdb1/users02.dbf'
                     TO '/u03/oracle/rbdb1/users01.dbf', 
                        '/u04/oracle/rbdb1/users02.dbf';
    
  5. Back up the database. After making any structural changes to a database, always perform an immediate and complete backup.

Procedure for Renaming and Relocating Datafiles in Multiple Tablespaces
You can rename and relocate datafiles in one or more tablespaces using the ALTER DATABASE RENAME FILE statement. This method is the only choice if you want to rename or relocate datafiles of several tablespaces in one operation. You must have the ALTER DATABASE system privilege.
Note:
To rename or relocate datafiles of the SYSTEM tablespace, the default temporary tablespace, or the active undo tablespace you must use this ALTERDATABASE method because you cannot take these tablespaces offline.
To rename datafiles in multiple tablespaces, follow these steps.
  1. Ensure that the database is mounted but closed.
    Note:
    Optionally, the database does not have to be closed, but the datafiles (or tempfiles) must be offline.
  2. Copy the datafiles to be renamed to their new locations and new names, using the operating system. You can copy the files using theDBMS_FILE_TRANSFER package discussed in "Copying Files Using the Database Server".
  3. Use ALTER DATABASE to rename the file pointers in the database control file.
    For example, the following statement renames the datafiles/u02/oracle/rbdb1/sort01.dbf and /u02/oracle/rbdb1/user3.dbf to/u02/oracle/rbdb1/temp01.dbf and /u02/oracle/rbdb1/users03.dbf, respectively:
    ALTER DATABASE
        RENAME FILE '/u02/oracle/rbdb1/sort01.dbf',
                    '/u02/oracle/rbdb1/user3.dbf'
                 TO '/u02/oracle/rbdb1/temp01.dbf',
                    '/u02/oracle/rbdb1/users03.dbf;
    
    Always provide complete filenames (including their paths) to properly identify the old and new datafiles. In particular, specify the old datafile names exactly as they appear in the DBA_DATA_FILES view.
  4. Back up the database. After making any structural changes to a database, always perform an immediate and complete backup.

Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.

How to find and eliminate migrated or chained rows


Step by step example.


How to find and eliminate Migrated and Chained rows
---------------------------------------------------

CONCEPTS:

* A row Migrates when a block was found to have the space available for
  a row which underwent an update that increased its size over and beyond
  its block's available space.

* A Chained row occurs when there is no block which can hold the row after 
  it underwent an update which increased its size beyond the available free 
  space in its hosting block. The solution is to split the row over several 
  blocks.          

CAUSES and EFFECTS:

* Causes for migrated and chained rows:  Inserts, updates and deletes over 
  periods of time

* Results from migrated and chained rows:  Degraded response for queries.


SOLUTION:

1)  Analyze the table:

    To prevent an ORA-1495 (specified chained row table not found), run the 
    $ORACLE_HOME/rdbms/admin/utlchain.sql script.
   
    TRUNCATE TABLE CHAINED_ROWS;
    ANALYZE TABLE <table name> LIST CHAINED ROWS;

2)  List the Migrated or Chained rows. 
     
    From SQL*Plus:

    col owner_name format a10
    col table_name format a20
    col head_rowid format a20

    select owner_name, table_name, head_rowid from chained_rows;

3)  You can now eliminate the Migrated or Chained rows by Create Table 
    as Select (CTAS), exporting and then importing the table or by following 
    the next steps:

    A) Create an empty copy of the table that has the Migrated or Chained rows.

       CREATE TABLE <temporary table name> AS
        SELECT * FROM <table name> WHERE ROWID IN
         (SELECT HEAD_ROWID FROM CHAINED_ROWS WHERE TABLE_NAME='<table name'>');

    B) Now delete the Migrated and Chained rows from the table.  
 
       DELETE FROM <table name> WHERE ROWID IN
        (SELECT HEAD_ROWID FROM CHAINED_ROWS 
         WHERE TABLE_NAME='<table name>');

    C) Insert the rows back to the table.

       INSERT INTO <table name> SELECT * FROM <temporary table name>;

    Truncate the chained_rows table and drop the temporary table.


Alternatively, you can move the table to a tablespace if the row cannot fit in the block and you need a tablespace with a larger block size:
   alter table <table_name> move <tablespace>;
   
Note: 
Check the SQL Reference guide for your release, for details on the 'alter table..move..' command.


Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.