Vous êtes sur la page 1sur 48

1. How can you locate the the software location (oracle_home) for a running database?

A. OraInst.loc file

2.How do you drop your user tablespace?


You cannot drop a tablespace that contains any active segments. For example, if a table in the tablespace is currently being used or the tablespace contains an active rollback segment, you cannot drop the tablespace. The tablespace can be online or offline, but it is best to take the tablespace offline before dropping it. To drop a tablespace, use the DROP TABLESPACE statement. The following statement drops the users tablespace, including the segments in the tablespace:
DROP TABLESPACE users INCLUDING CONTENTS;

If the tablespace is empty (does not contain any tables, views, or other structures), you do not need to specify the INCLUDING CONTENTS option. Use the CASCADE CONSTRAINTS option to drop all referential integrity constraints from tables outside the tablespace that refer to primary and unique keys of tables inside the tablespace. To delete the datafiles associated with a tablespace at the same time that the tablespace is dropped, use the INCLUDING CONTENTS AND DATAFILES clause. The following statement drops the USER tablespace and its associated datafiles:
DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES;

A message is written to the alert file for each datafile that is deleted. If an operating system error prevents the deletion of a file, the DROP TABLESPACE statement still succeeds, but a message describing the error is written to the alert file.

3.How do you see the logical structure of the database.


A. Dba_objects

4.How do you calculate the tablesize?


Select segment_name, bytes/1024/1024 from dba_segments where segment_name=<table name>;

5. How do you move one table from one tablespace to another? Alter table <tab name> move tablespace <tablespace name>;

6. How to size your undo tablespace?


V$UNDOSTAT displays a histogram of statistical data to show how well the system is working. The available statistics include undo space consumption, transaction concurrency, and length of queries executed in the instance. You can use this view to estimate the amount of undo space required for the current workload. Oracle uses this view to tune undo usage in the system. This view is available in both automatic undo management mode and manual undo management mode. Each row in the view keeps statistics collected in the instance for a 10-minute interval. The rows are in descending order by the BEGIN_TIME column value. Each row belongs to the time interval marked by (BEGIN_TIME, END_TIME). Each column represents the data collected for the particular statistic in that time interval. The first row of the view contains statistics for the (partial) current time period. The view contains a total of 1008 rows, spanning a 7 day cycle. With the help of this view (mainly) we can estimate the total undospace you require and expand it accordingly. Estimate the size of UNDO tablespace Sizing an UNDO tablespace requires three pieces of data. 1. 2. 3. (UR) UNDO_RETENTION in seconds (UPS) Number of undo data blocks generated per second (DBS) Overhead varies based on extent and file size (db_block_size)

UndoSpace = [UR * (UPS * DBS)] + (DBS * 24)


Two can be obtained from the initialization file: UNDO_RETENTION and DB_BLOCK_SIZE. The third piece of the formula requires a query against the database. The number of undo blocks generated per second can be acquired from V$UNDOSTAT. The following formula calculates the total number of blocks generated and divides it by the amount of time monitored, in seconds:

SQL> SELECT (SUM(undoblks))/ SUM ((end_time - begin_time) * 86400) FROM v$undostat;

Column END_TIME and BEGIN_TIME are DATE data types. When DATE data types are subtracted, the result is in days. To convert days to seconds, you multiply by 86400, the number of seconds in a day. The result of the query returns the number of undo blocks per second. This value needs to be multiplied by the size of an undo block, which is the same size as the database block defined in DB_BLOCK_SIZE. The following query calculates the number of bytes needed:

SQL> SELECT (UR * (UPS * DBS)) + (DBS * 24) AS "Bytes" FROM (SELECT value AS UR FROM v$parameter WHERE name = 'undo_retention'), (SELECT (SUM(undoblks)/SUM(((end_time - begin_time)*86400))) AS UPS FROM v$undostat), (select block_size as DBS from dba_tablespaces where tablespace_name= (select value from v$parameter where name = 'undo_tablespace'));

7. how do you resize the online redo log files?


One of the best ways I have found to resize or recreate online redo log files and keep the current sequence is to perform it online. In this example, we will resize all online redo logs from 100MB to 250MB while the database is running and use SQL*Plus to drop/recreate them in stages. Before looking at the tasks involved to perform the resize, let's look at the current online redo log groups and their sizes:

SQL> SELECT a.group#, a.member, b.bytes 2 FROM v$logfile a, v$log b WHERE a.group# = b.group#; GROUP# ---------1 1 1 2 2 2 3 3 3 MEMBER BYTES ---------------------------------------- -----------/u03/app/oradata/ORA920/redo_g01a.log 104,857,600 /u04/app/oradata/ORA920/redo_g01b.log 104,857,600 /u05/app/oradata/ORA920/redo_g01c.log 104,857,600 /u03/app/oradata/ORA920/redo_g02a.log 104,857,600 /u04/app/oradata/ORA920/redo_g02b.log 104,857,600 /u05/app/oradata/ORA920/redo_g02c.log 104,857,600 /u03/app/oradata/ORA920/redo_g03a.log 104,857,600 /u04/app/oradata/ORA920/redo_g03b.log 104,857,600 /u05/app/oradata/ORA920/redo_g03c.log 104,857,600

9 rows selected. Now let's take a look at the steps involved to resize / recreate all online redo log groups:

1. Make the last redo log CURRENT


Force a log switch until the last redo log is marked "CURRENT" by issuing the following command:

SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------CURRENT INACTIVE INACTIVE

SQL> alter system switch logfile; SQL> alter system switch logfile; SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------INACTIVE INACTIVE CURRENT

2. Drop first redo log


After making the last online redo log file the CURRENT one, drop the first online redo log:

SQL> alter database drop logfile group 1; Database altered. As a DBA, you should already be aware that if you are going to drop a logfile group, it cannot be the current logfile group. I have run into instances; however, where attempting to drop the logfile group resulted in the following error as a result of the logfile group having an active status: SQL> ALTER DATABASE DROP LOGFILE GROUP 1; ALTER DATABASE DROP LOGFILE GROUP 1 * ERROR at line 1: ORA-01624: log 1 needed for crash recovery of instance ORA920 (thread 1) ORA-00312: online log 1 thread 1: '<file_name>' Easy problem to resolve. Simply perform a checkpoint on the database: SQL> ALTER SYSTEM CHECKPOINT GLOBAL; System altered. SQL> ALTER DATABASE DROP LOGFILE GROUP 1; Database altered.

3. Re-create dropped online redo log group


Re-create the dropped redo log group with different size (if desired):

SQL> alter database add logfile group 1 ( 2 '/u03/app/oradata/ORA920/redo_g01a.log',

3 4

'/u04/app/oradata/ORA920/redo_g01b.log', '/u05/app/oradata/ORA920/redo_g01c.log') size 250m reuse;

Database altered.

4. Force another log switch


After re-creating the online redo log group, force a log switch. The online redo log group just created should become the "CURRENT" one:

SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------UNUSED INACTIVE CURRENT

SQL> alter system switch logfile; SQL> select group#, status from v$log; GROUP# ---------1 2 3 STATUS ---------------CURRENT INACTIVE ACTIVE

5. Loop back to Step 2 until all logs are rebuilt


After re-creating an online redo log group, continue to re-create (or resize) all online redo log groups until all of them are rebuilt. After rebuilding (resizing) all online redo log groups, here is a snapshot of all physical files:

SQL> SELECT a.group#, a.member, b.bytes 2 FROM v$logfile a, v$log b WHERE a.group# = b.group#; GROUP# ---------1 1 1 2 2 2 3 3 3 MEMBER BYTES ---------------------------------------- -----------/u03/app/oradata/ORA920/redo_g01a.log 262,144,000 /u04/app/oradata/ORA920/redo_g01b.log 262,144,000 /u05/app/oradata/ORA920/redo_g01c.log 262,144,000 /u03/app/oradata/ORA920/redo_g02a.log 262,144,000 /u04/app/oradata/ORA920/redo_g02b.log 262,144,000 /u05/app/oradata/ORA920/redo_g02c.log 262,144,000 /u03/app/oradata/ORA920/redo_g03a.log 262,144,000 /u04/app/oradata/ORA920/redo_g03b.log 262,144,000 /u05/app/oradata/ORA920/redo_g03c.log 262,144,000

9 rows selected.

6.How do you move or rename the redo log groups from one disk to other?
You can use operating system commands to relocate online redo logs, then use the ALTER DATABASE statement to make their new names (locations) known to the database. This procedure is necessary, for example, if the disk currently used for some online redo log files is going to be removed, or if datafiles and a number of online redo log files are stored on the same disk and should be separated to reduce contention. To rename online redo log members, you must have the ALTER DATABASE system privilege. Additionally, you might also need operating system privileges to copy files to the desired location and privileges to open and back up the database. Before relocating your redo logs, or making any other structural changes to the database, completely back up the database in case you experience problems while performing the operation. As a precaution, after renaming or relocating a set of online redo log files, immediately back up the database's control file. Use the following steps for relocating redo logs. The example used to illustrate these steps assumes:

The log files are located on two disks: diska and diskb. The online redo log is duplexed: one group consists of the members /diska/logs/log1a.rdo and /diskb/logs/log1b.rdo, and the second group consists of the members /diska/logs/log2a.rdo and /diskb/logs/log2b.rdo. The online redo log files located on diska must be relocated to diskc. The new filenames will reflect the new location: /diskc/logs/log1c.rdo and /diskc/logs/log2c.rdo.

Steps for Renaming Online Redo Log Members

1. Shut down the database.


2. SHUTDOWN 3.

2. Copy the online redo log files to the new location. Operating system files, such as online redo log members, must be copied using the appropriate operating system commands. See your operating system specific documentation for more information about copying files. Note: You can execute an operating system command to copy a file (or perform

other operating system commands) without exiting SQL*Plus by using the HOST command. Some operating systems allow you to use a character in place of the word HOST. For example, you can use ! in UNIX.

The following example uses operating system commands (UNIX) to move the online redo log members to a new location:
mv /diska/logs/log1a.rdo /diskc/logs/log1c.rdo mv /diska/logs/log2a.rdo /diskc/logs/log2c.rdo

3. Startup the database, mount, but do not open it.


4. CONNECT / as SYSDBA 5. STARTUP MOUNT 6.

4. Rename the online redo log members. Use the ALTER DATABASE statement with the RENAME FILE clause to rename the database's online redo log files.
ALTER DATABASE RENAME FILE '/diska/logs/log1a.rdo', '/diska/logs/log2a.rdo' TO '/diskc/logs/log1c.rdo', '/diskc/logs/log2c.rdo';

5. Open the database for normal operation. The online redo log alterations take effect when the database is opened.
ALTER DATABASE OPEN;

7.How do you specify the default tablespace when you create a table? 8. how do you rename your datafiles;
Same as the redo log file rename.
SQL> shutdown
The files can be copied to their destination:

$ cp /home/oracle/OraHome1/databases/ora9/system.dbf /home/oracle/databases/ora9/system.dbf $ cp /home/oracle/OraHome1/databases/ora9/undo.dbf /home/oracle/databases/ora9/undo.dbf

$ cp /home/oracle/OraHome1/databases/ora9/data.dbf /home/oracle/databases/ora9/data.dbf $ $ cp /home/oracle/OraHome1/databases/ora9/redo1.ora /home/oracle/databases/ora9/redo1.ora $ cp /home/oracle/OraHome1/databases/ora9/redo2.ora /home/oracle/databases/ora9/redo2.ora $ cp /home/oracle/OraHome1/databases/ora9/redo3.ora /home/oracle/databases/ora9/redo3.ora $ $ cp /home/oracle/OraHome1/databases/ora9/ctl_1.ora /home/oracle/databases/ora9/ctl_1.ora $ cp /home/oracle/OraHome1/databases/ora9/ctl_2.ora /home/oracle/databases/ora9/ctl_2.ora $ cp /home/oracle/OraHome1/databases/ora9/ctl_3.ora /home/oracle/databases/ora9/ctl_3.ora
The init.ora file is also copied because it references the control files. I name the copied file just init.ora because it is not in a standard place anymore and it will have to be named explicitely anyway when the database is started up.

$ cp /home/oracle/OraHome1/dbs/initORA9.ora /home/oracle/databases/ora9/init.ora
The new location for the control files must be written into the (copied) init.ora file:
/home/oracle/databases/ora9/init.ora

control_files = (/home/oracle/databases/ora9/ctl_1.ora, /home/oracle/databases/ora9/ctl_2.ora, /home/oracle/databases/ora9/ctl_3.ora) $ sqlplus "/ as sysdba" SQL> startup exclusive mount pfile=/home/oracle/databases/ora9/init.ora SQL> alter database rename file '/home/oracle/OraHome1/databases/ora9/system.dbf' to '/home/oracle/databases/ora9/system.dbf'; SQL> alter database rename file '/home/oracle/OraHome1/databases/ora9/undo.dbf' '/home/oracle/databases/ora9/undo.dbf'; SQL> alter database rename file '/home/oracle/OraHome1/databases/ora9/data.dbf' '/home/oracle/databases/ora9/data.dbf'; to

to

SQL> alter database rename file '/home/oracle/OraHome1/databases/ora9/redo1.ora' '/home/oracle/databases/ora9/redo1.ora'; SQL> alter database rename file '/home/oracle/OraHome1/databases/ora9/redo2.ora' '/home/oracle/databases/ora9/redo2.ora'; SQL> alter database rename file '/home/oracle/OraHome1/databases/ora9/redo3.ora' '/home/oracle/databases/ora9/redo3.ora'; SQL> shutdown

to

to

to

SQL> startup pfile=/home/oracle/databases/ora9/init.ora

================================================================ 9. How to do manual reorg ? Customer is that his data is 2 GB but the tablespace is growing huge more than the 10gb. How to trouble shoot.?

Manual Tablespace Reorganization


This method can take one of two forms. It you are happy to change the datafile name do the following: Create a new tablespace. Move the segments to the new tablespace. Drop the original tablespace. Rename the new tablespace to match the original name.

If the datafile name must remain the same do the following: Create a new tablespace. Move the segments to the new tablespace. Resize the original datafile. Move the segments back to the original tablespace. Drop the new tablespace.

Obviously the second method requires much more work as all segments are being moved twice. The way to move segments depends on the type of segment being moved. Here are a few examples. -- Move a table segment. ALTER TABLE tab1 MOVE TABLESPACE new_ts; -- Move an index segment. ALTER INDEX ind1 REBUILD TABLESPACE new_ts; ALTER INDEX ind1 REBUILD TABLESPACE new_ts ONLINE; -- Move a table partition segment. (Remember to check for unusable indexes)

ALTER TABLE tab1 MOVE PARTITION part_1 TABLESPACE new_ts NOLOGGING; -- Move an index partition segment. ALTER INDEX ind1 REBUILD PARTITION ind1_part1 TABLESPACE new_ts; -- Move LOB segments if we had them. -- ALTER TABLE tab1 MOVE LOB(lob_column_name) STORE AS (TABLESPACE new_ts); Of course, the tables and their respective indexes could be moved using the Online Table Redefinition Functionality Of course, the tables and their respective indexes could be moved using the Online Table Redefinition functionality. The following example performs a manual reorganization where the datafile name is not retained. Remember to recreate the test environment before starting this example. First, create a new tablespace to hold the objects. CONN / AS SYSDBA CREATE TABLESPACE reclaim_ts_temp DATAFILE '/u01/app/oracle/oradata/DB11G/reclaim02.dbf' SIZE 1M AUTOEXTEND ON NEXT 1M; ALTER USER reclaim_user QUOTA UNLIMITED ON reclaim_ts_temp; Move the objects to the new tablespace. ALTER TABLE reclaim_user.t1 MOVE TABLESPACE reclaim_ts_temp; ALTER INDEX reclaim_user.t1_pk REBUILD TABLESPACE reclaim_ts_temp; ALTER TABLE reclaim_user.t2 MOVE TABLESPACE reclaim_ts_temp; ALTER INDEX reclaim_user.t2_pk REBUILD TABLESPACE reclaim_ts_temp; Drop the original tablespace and rename the new one back to the original name. DROP TABLESPACE reclaim_ts INCLUDING CONTENTS AND DATAFILES; ALTER TABLESPACE reclaim_ts_temp RENAME TO reclaim_ts;

================================================================

10. What are the export ans import uses?


1.Backup and recovery (small databases only, say < +50GB, if bigger, use RMAN instead)

2.Move data between Oracle databases on different platforms (for example from Solaris to Windows)

3.Reorganization of data/ eliminate database fragmentation (export, drop and re-import tables)

4.Upgrade databases from extremely old versions of Oracle (when in-place upgrades are not supported by the Database Upgrade Assistant any more)

5.Detect database corruption. Ensure that all the data can be read 6.Transporting tablespaces between databases

11.How to relocate or move the services in RAC by using srvctl command:

srvctl relocate service


Temporarily relocates a service member to run on another instance.
Syntax and Options

Use the srvctl relocate service command with the following syntax:
srvctl relocate service -d db_unique_name -s service_name -i old_inst_name -t new_inst_name [-f]

Table B-40 srvctl relocate service Options


Option
-d db_unique_name

Description Unique name for the database. Service name. Old instance name. New instance name. Disconnect all sessions during stop or relocate service operations.

-s service_name
-i old_inst_name -t new_inst_name -f

Example

To temporarily relocate a named service member from crm1 to crm3:


srvctl relocate service -d crm -s crm -i crm1 -t crm3

12. How can you see what are the services are running on the database?
Lsnrctl status

rh4lab12:/home/oracle[orcl]$ lsnrctl stat [...] Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "orcl.lab.ardentperf.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclXDB.lab.ardentperf.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orcl_XPT.lab.ardentperf.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "test1.lab.ardentperf.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "test2.lab.ardentperf.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "test3.lab.ardentperf.com" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully

13.What is the load balancing advisery?

14.What is the server side load balancing? Server-Side Load Balancing


With server-side load balancing, the Listener directs a connection request to the best instance currently providing the service by using information from the Load Balancing Advisory. For each service, you can define the method that you want the Listener to use for load balancing by setting the connection load balancing goal. You can use a goal of either long or short for connection load balancing. These goals have the following characteristics:

ShortConnections are distributed across instances based on the elapsed time under the service. Use the Short connection load balancing goal for applications that have connections of small duration. LongConnections are distributed across instances based on the number of sessions per instance, for each instance that supports the service. Use the Long connection load balancing goal for applications that have connections of long duration. This is typical for connection

pools and SQL*Forms sessions. Long is the default connection load balancing goal. Any services created by using DBCA use the Long connection load balancing goal by default.

Client-Side Load Balancing


Client-side load balancing balances the connection requests across the Listeners. When the Listener receives the connection request, the Listener connects the user to an instance that the Listener knows provides the requested service. Client-side load balancing is defined in your client connection definition by setting the parameter LOAD_BALANCE=yes in the tnsnames.ora file. When you set this parameter to yes, the Oracle client randomly selects an address from the address list, and connects to that node's Listener. This balances client connections across the available Listeners in the cluster. When you create an Oracle RAC database with DBCA, it creates a sample client-side load balancing connection definition in the tnsnames.ora file on the server. Client-side load balancing includes connection failover. With connection failover, if an error is returned from the chosen address, Oracle Net Services will try the next address in the address list until either a successful connection is made or it has exhausted all the addresses in the list.

How to upgrade the RAC database?

Patching Oracle RAC 10.2.0.1 on ASM with 10.2.0.4 Patch Set 3 for Linux x86
Using your oracle user, download and unzip the file p6810189_10204_Linux-x86.zip.

First of all, before applying the 10.2.0.4 patchset to the Oracle database you should verify if the DSTv4 (USA 2007) update included in the 10.2.0.4 patchset has implications on your database. Following the NoteId 553812.1 provided by Metalink the goal is to see if you have stored information that is affected and

if you are already using a DST version higher then DSTv4 and what then to do.

Because I'm patching from a lower 10.2.0.X release to 10.2.0.4 I hav to execute the following query to check the current version of the Oracle time zone definitions: SQL> SELECT version FROM v$timezone_file; Becuse my current timezone version is lower then 4, I need to execute this other query to check if I'm storing *user* TZ (TSTZ and TSLTZ) data: SQL> select c.owner || '.' || c.table_name || '(' || c.column_name || ') -' || c.data_type || ' ' col from dba_tab_cols c, dba_objects o where c.data_type like '%TIME ZONE' and c.owner=o.owner and c.table_name = o.object_name and o.object_type = 'TABLE' order by col My output shows there is nothing outside the Data Dictionary (= other then SYS objects).

The following queries SQL> SELECT object_name FROM dba_objects WHERE object_id IN (SELECT obj# FROM scheduler$_window); SQL> SELECT object_name FROM dba_objects WHERE object_id IN (SELECT obj# FROM scheduler$_job); show I have only 6 jobs defined and I have also no user TZ (TSTZ and TSLTZ) data, so there is no action to take for the Oracle time zone definitions, and I can simply upgrade from 10.2.0.1 to 10.2.0.4.

Now I have to stop one node because I need to patch first the clusterware software and it can be done using rolling updates. Run the following commands from the first node of your RAC installation: emctl stop dbconsole

isqlplusctl stop srvctl stop service -d DWHDB -s DWHDB_TAF -i DWHDB1 srvctl stop instance -d DWHDB -i DWHDB1 -o immediate srvctl stop asm -n bl3306 srvctl stop nodeapps -n bl3306

Go into the directory Disk1 and run ./runInstaller &

A Welcome screen appears.

Specify the home details for the clusterware home.

Click next on the cluster nodes screen.

It checks for product-specific prerequisites.

Click Install

And the Clusterware patching is starting.

Before click the EXIT button and complete the installation,login as root on the first node and execute the

following command as suggested:

Run /u01/app/oracle/product/10.2.0/crs_1/crsctl stop crs /u01/app/oracle/product/10.2.0/crs_1/install/root102.sh

They stop and start the crs services on the first node. Execute the same command on every nodes, I ru them only on my second node: /u01/app/oracle/product/10.2.0/crs_1/crsctl stop crs /u01/app/oracle/product/10.2.0/crs_1/install/root102.sh

Then execute as oracle user from one node: crsctl query crs activeversion

Execute as oracle user from second node: crsctl query crs activeversion

The clusterware software has been updated. Click EXIT and then YES from the OUI interface.

Now execute the following command to completely stop the database (this patchset doesn't support rolling updates) from your first node: emctl stop dbconsole isqlplusctl stop srvctl stop service -d database DWHDB -s DWHDB_TAF -i DWHDB1 srvctl stop database -d DWHDB -o immediate srvctl stop asm -n bl3306 srvctl stop nodeapps -n bl3306

Execute the following command to completely stop the asm instance from your second node: emctl stop dbconsole isqlplusctl stop srvctl stop asm -n bl3305 srvctl stop nodeapps -n bl3305

As oracle user run again the runInstaller

Click NEXT on Welcome screen.

Choose the Oracle home.

Click NEXT on cluster installation mode screen.

Click NEXT on prerequisite checks screen.

Enable and register your Oracle Configuration Manager.

Accept the license agreement

and test your registration

Click INSTALL on summary screen.

The installation is proceeding.

When asked execute as root user the following command on your first node /u01/app/oracle/product/10.2.0/db_1/root.sh

and then again from your second node.

Clic EXIT on End of Installation screen

and the YES

Only from your first node, login as oracle user and execute: srvctl start asm -n bl3306 srvctl start listener -n bl3306

Then run dbua

Click NEXT on Welcome screen.

Select Upgrade a Database and click NEXT.

Select your database and click NEXT, providing a user with sysdba privileges.

The upgrade of the database starts.

Choose the degree of parallelism to recompile any invalid objects, turn off archiving and click NEXT.

Specify your Flash Recovery Area and click NEXT.

Click FINISH on Summary screen.

================================================== ================================================== ================================================== =====

How to apply CPU patch in RAC?

How to apply CPU patch in RAC environment using rolling upgrade


"The term rolling upgrade refers to upgrading different databases or different instances of the same database (in a Real Application Clusters environment) one at a time, without stopping the database. The advantage of a RAC rolling upgrade is that it enables at least some instances of the RAC installation to be available during the scheduled outage required for patch upgrades. Only the RAC instance that is currently being patched needs to be brought down. The other instances can continue to remain available. This means that the impact on the application downtime required for such scheduled outages is further minimized. Oracle's opatch utility enables the user to apply the patch successively to the different instances of the RAC installation. Rolling upgrade is available only for patches that have been certified by Oracle to be eligible for rolling upgrades. Typically, patches that can be installed in a rolling upgrade include: Patches that do not affect the contents of the database such as the data dictionary Patches not related to RAC internode communication Patches related to client-side tools such as SQL*PLUS, Oracle utilities, development libraries, and Oracle Net Patches that do not change shared database resources such as datafile headers, control files, and common header definitions of kernel modules Rolling upgrade of patches is currently available for one-off patches only. It is not available for patch sets.

Rolling patch upgrades are not available for deployments where the Oracle Database software is shared across the different nodes. This is the case where the Oracle home is on Cluster File System (CFS) or on shared volumes provided by file servers or NFS-mounted drives. The feature is only available where each node has its own copy of the Oracle Database software."

Lets apply Patch 8576156 using Rolling upgrade

OPatch Utility Information


You must use the OPatch 10.2 version 10.2.0.4.7 or later to apply this patch. Oracle recommends that you use the latest released OPatch 10.2, which is available for download from My Oracle Support patch 6880880 by selecting the 10.2.0.0.0 release.
Author A.Kishore

http:/www.appsdba.info
rac1-> cd /u01/app/oracle/product/10.2.0/db_1/OPatch/ rac1-> ./opatch version Invoking OPatch 10.2.0.4.2 OPatch Version: 10.2.0.4.2 OPatch succeeded. Download 6880880

cd /u01/app/oracle/product/10.2.0/db_1 rac1-> mv OPatch old_Opatch rac1-> ls p6880880_112000_LINUX.zip


Author A.Kishore

http:/www.appsdba.info p6880880_112000_LINUX.zip rac1-> unzip p6880880_112000_LINUX.zip rac1-> cd OPatch/ rac1-> ./opatch version Invoking OPatch 11.2.0.1.2 OPatch Version: 11.2.0.1.2 OPatch succeeded.

Patch Installation Instructions for a RAC Environment

Follow these steps: 1. Ensure that your Oracle Database installation is the same release for which you are applying this patch 2. Shut down the instance on one node. 3. Shut down all nodeapps services on the node in step 1: 4. srvctl stop nodeapps -n <node-name> 5. Apply the patch on the node in step 1. Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following commands: unzip p8576156_10204_Linux-x86.zip cd 8576156 opatch apply 6. Start the instance on the node in step 1. 7. Start all nodeapps services on the node in step 1: 8. srvctl start nodeapps -n <node-name>
Author A.Kishore

http:/www.appsdba.info 9. Shut down the instance on the next node. 10. Repeat steps 1-6 on all the nodes in the cluster.

srvctl stop nodeapps n rac1 srvctl stop instance -d devdb -i devdb1 srvctl stop asm -n rac1

ps -ef |grep smon oracle 6097 4987 0 14:30 pts/1 00:00:00 grep smon n Check that no oracle process is running on rac1 Verify whether there is any conflicts unzip p8576156_10204_Linux-x86.zip Author A.Kishore

http:/www.appsdba.info

/u01/app/oracle/product/10.2.0/db_1/OPatch/opatch prereq CheckConflictAga instOHWithDetail -phBaseDir ./8576156 --- Apply the patch cd 8576156 /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply n Check whether the patch is applied or not n $ORACLE_HOME/OPatch lsinventory Start the services

srvctl start asm -n rac1 srvctl start instance -d devdb -i devdb1 srvctl start nodeapps n rac1
Author A.Kishore

http:/www.appsdba.info

Apply the patch on the second node

srvctl stop nodeapps -n rac2 srvctl stop instance -d devdb -i devdb2 srvctl stop asm -n rac2
Author A.Kishore

http:/www.appsdba.info
Allocate the DB connection to rac1 crs_relocate ora.devdb.db Author A.Kishore

http:/www.appsdba.info
rac2-> cd 8576156/ rac2-> /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply This node is part of an Oracle Real Application Cluster. Remote nodes: 'rac1' Local node: 'rac2' Please shutdown Oracle instances running out of this ORACLE_HOME on the local system. (Oracle Home = '/u01/app/oracle/product/10.2.0/db_1') Is the local system ready for patching? [y|n] y User Responded with: Y Author A.Kishore

http:/www.appsdba.info srvctl start asm -n rac2 srvctl start instance -d devdb -i devdb2 srvctl start nodeapps n rac2

2.3.3 Post Installation Instructions 2.3.3.1 Loading Modified .sql Files into the Database

The following steps load modified .sql files into the database. For a RAC environment, perform these steps on only one node. (Note that if there is a database in the Oracle home that you are patching, this will involve starting all database instances running from this Oracle home.) 1. For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql script as follows: cd $ORACLE_HOME/rdbms/admin sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> STARTUP SQL> @catbundle.sql psu apply SQL> QUIT Check the following log files in $ORACLE_HOME/cfgtoollogs/catbundle any errors: catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
2.3.3.2 Recompiling Views in the Database

1. If the database is in a RAC environment, run the view recompilation script as follows. Note that this script is run with the database in upgrade mode, which restricts connections as SYSDBA. Stop all instances except the one where the view recompilation is being executed.
Author A.Kishore

http:/www.appsdba.info srvctl stop database -d devdb cd $ORACLE_HOME/cpu/view_recompile sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> STARTUP NOMOUNT SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile; SQL> SHUTDOWN SQL> STARTUP UPGRADE SQL> @view_recompile_jan2008cpu.sql SQL> SHUTDOWN; SQL> STARTUP NOMOUNT; Set the CLUSTER_DATABASE initialization parameter to TRUE: SQL> ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=spfile; Restart the database: SQL> QUIT cd $CRS_HOME/bin srvctl start database -d <database-name> If any invalid objects were reported, run the utlrp.sql script as follows: cd $ORACLE_HOME/rdbms/admin sqlplus /nolog SQL> CONNECT / AS SYSDBA

SQL> @utlrp.sql

Cloning Database From Hot Backup


To clone a db on another machine from hot backup, follow these steps: 1. Install Oracle server on new machine 2. Create directories, initfile, etc for the copy database on second server 3. Add database name to tnsnames.ora, listener.ora on second server 4. Create database service with ORADIM (if OS is Windows) 5. On original OPEN db: ALTER DATABASE BACKUP CONTROL FILE TO TRACE RESETLOGS; 6. Rename trace file to create_control.sql, edited, contents are as follows: STARTUP NOMOUNT CREATE CONTROLFILE SET DATABASE "<SID>" RESETLOGS ARCHIVELOG ... ... ; 7. Then do: ALTER SYSTEM ARCHIVE LOG CURRENT; 8. Copy the ORADATA dirctory including archived logs to second server 9. Go to second server, set SID, and use sqlplus to connect as SYSDBA 10. Delete the control files already copied over using OS commands 11. Run the CREATE CONTROL file script shown above 12. Issue: RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;

How can you size your temporary tablespace?

Prerequisite Ensure that you have SYSCTRL or SYSADM authority to create a system temporary table space if required. Procedure To ensure that the maximum page size of your system temporary table space is large enough for your queries or positioned updates: 1. Determine the maximum row size in your result sets from queries or positioned updates. Monitor your queries or calculate the maximum row size using the DDL statement that you used to create your tables. 2. List your table spaces using the LIST TABLESPACES command, as shown in the following example:

3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. ...

db2 LIST TABLESPACES SHOW DETAIL ... Tablespace ID Name Type Contents State Detailed explanation: Normal Total pages Useable pages Used pages Free pages High water mark (pages) Page size (bytes) Extent size (pages) Prefetch size (pages) Number of containers

= = = = = = = = = = = = = =

1 TEMPSPACE1 System managed space System Temporary data 0x0000 10 10 10 Not applicable Not applicable 4096 32 320 10

You can identify the system temporary table spaces in the output by looking for table spaces whose Contents fields have a value of System Temporary data. Take note of the page size for each of your system temporary table spaces and the page size of the table spaces where the tables referenced in the queries or updates were created. 21. Check whether the largest row size in your result sets fits into your system temporary table space page size:

22. maximum_row_size > maximum_row_length - 8 bytes (structure overhead in 23. single partition) maximum_row_size > maximum_row_length - 16 bytes (structure overhead in DPF)

where maximum_row_size is the maximum row size for your result sets, and maximum_row_length is the maximum length allowed based on the largest page size of all of your system temporary table spaces. Review the database manager page size-specific limits to determine the maximum row length per table space page size. If the maximum row size is less than the calculated value then your queries will run in the same manner that they did in DB2 UDB Version 8, and you do not need to continue with this task.

24.

Create a system temporary table space that is at least one page size larger than the table space page size where the tables were created if you do not already have a system temporary table with that page size. For example, on the Windows operating systems, if you created your table in a table space with 4 KB page size , create the additional system temporary table space using an 8 KB page size:

25. 26. 27.

db2 CREATE SYSTEM TEMPORARY TABLESPACE tmp_tbsp PAGESIZE 8K MANAGED BY SYSTEM USING ('d:\tmp_tbsp','e:\tmp_tbsp')

If your table space page size is 32 KB, you can reduce the information that you are selecting in your queries or split the queries to fit in the system temporary table space page. For example, if you select all columns from a table, you can instead select only the columns that you really required or a substring of certain columns to avoid exceeding the page

How can you size the undo tablespace?


V$UNDOSTAT displays a histogram of statistical data to show how well the system is working. The available statistics include undo space consumption, transaction concurrency, and length of queries executed in the instance. You can use this view to estimate the amount of undo space required for the current workload. Oracle uses this view to tune undo usage in the system. This view is available in both automatic undo management mode and manual undo management mode. Each row in the view keeps statistics collected in the instance for a 10-minute interval. The rows are in descending order by the BEGIN_TIME column value. Each row belongs to the time interval marked by (BEGIN_TIME, END_TIME). Each column represents the data collected for the particular statistic in that time interval. The first row of the view contains statistics for the (partial) current time period. The view contains a total of 1008 rows, spanning a 7 day cycle. With the help of this view (mainly) we can estimate the total undospace you require and expand it accordingly. Estimate the size of UNDO tablespace Sizing an UNDO tablespace requires three pieces of data. 1. 2. 3. (UR) UNDO_RETENTION in seconds (UPS) Number of undo data blocks generated per second (DBS) Overhead varies based on extent and file size (db_block_size)

UndoSpace = [UR * (UPS * DBS)] + (DBS * 24)


Two can be obtained from the initialization file: UNDO_RETENTION and DB_BLOCK_SIZE. The third piece of the formula requires a query against the database. The number of undo blocks generated per second can be acquired from V$UNDOSTAT. The following formula calculates the total number of blocks generated and divides it by the amount of time monitored, in seconds:

SQL> SELECT (SUM(undoblks))/ SUM ((end_time - begin_time) * 86400)

FROM v$undostat;

Column END_TIME and BEGIN_TIME are DATE data types. When DATE data types are subtracted, the result is in days. To convert days to seconds, you multiply by 86400, the number of seconds in a day. The result of the query returns the number of undo blocks per second. This value needs to be multiplied by the size of an undo block, which is the same size as the database block defined in DB_BLOCK_SIZE. The following query calculates the number of bytes needed:

SQL> SELECT (UR * (UPS * DBS)) + (DBS * 24) AS "Bytes"

FROM (SELECT value AS UR FROM v$parameter WHERE name = 'undo_retention'),

(SELECT (SUM(undoblks)/SUM(((end_time - begin_time)*86400))) AS UPS FROM v$undostat),

(select block_size as DBS from dba_tablespaces where tablespace_name=

(select value from v$parameter where name = 'undo_tablespace'));

If the VPN is down then what you will do ?


Your both VIPs i.e. 192.200.10.45 , 192.200.10.46 are on node1. Did you try stopping/starting nodeapps on node2 ? srvctl stop nodeapps -n node2 srvctl start nodeapps -n node2 If vip is still not shifting , use below command : Then you can relocate the VIP using the crs_relocate utility found in CRS_HOME/bin directory crs_relocate ora.rac2.vip

How do you know the patch is rolling patch or not in RAC


How do you deter mine the patch is rolling or not?

5 - How to determine if a patch is a "rolling patch" or not? - 9i or 10gR1: (run) $ opatch query -is_rolling Opatch will ask the patch location and then will inform if the patch is or not a "rolling patch" - 10gR2: (run) $ opatch query -all <patch_location> | grep rolling For Windows, the following command can be used as grep is not suitable: opatch query -all C:\stage\10.2.0.3_Mini_Patches\5731537 | findstr rolling Patch is a rolling patch: false

To recover the database with an autobackup of the control file without a recovery catalog:
1. Start RMAN and connect to the target database. For example, run:
2. CONNECT TARGET / 3. 3. STARTUP NOMOUNT; 4.

2. Start the target instance without mounting the database. For example: 3. Set the database identifier for the target database with SET DBID. RMAN displays the DBID whenever you connect to the target. You can also obtain it by inspecting saved RMAN log files, querying the catalog, or looking at the filenames of control file autobackup. (refer to "Restoring When Multiple Databases in the Catalog Share the Same Name: Example"). For example, run:
4. SET DBID 676549873; 5.

4. Restore the autobackup control file, then perform recovery. Do the following: a. Optionally, specify the most recent backup time stamp that RMAN can use when searching for a control file autobackup to restore. b. If a nondefault format was used to create the control file, then specify a nondefault format for the restore of the control file. c. If the channel that created the control file autobackup was device type sbt, then you must allocate one or more sbt channels. Because no repository is available, you cannot use preconfigured channels. If the autobackup was created on a disk channel, however, then you do not need to manually allocate a channel. d. Restore the autobackup of the control file, optionally setting the maximum number of days backward that RMAN can search (up to 366)

and the initial sequence number that it should use in its search for the first day. e. If you know that your control file contained information about configured channels that will be useful to you in the rest of the restore process, you can exit the RMAN client at this point, to clear manually allocated channels from step "c". If you then restart the RMAN client and mount the database those configured channels become available for your use in the rest of the restore and recovery process.

If you do not care about using configured channels from your control file, then you can simply mount the database at this point.
f. If the online logs are inaccessible, then restore and recover the database as described in "Performing Database Point-In-Time Recovery". You must terminate recovery by setting the UNTIL clause to a time, log sequence, or SCN before the online redo logs. If the online logs are usable, then perform a complete recovery as described in Oracle Database Backup and Recovery Basics.

In this example, the online redo logs have been lost. This example limits the restore of the control file autobackup, then performs recovery of the database to log sequence 13243, which is the most recent archived log:
RUN { # Optionally, set upper limit for eligible time stamps of control file # backups # SET UNTIL TIME '09/10/2000 13:45:00'; # Specify a nondefault autobackup format only if required # SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK # TO '?/oradata/%F.bck'; ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS='...'; # allocate manually RESTORE CONTROLFILE FROM AUTOBACKUP MAXSEQ 100 # start at sequence 100 and count down MAXDAYS 180; # start at UNTIL TIME and search back 6 months ALTER DATABASE MOUNT DATABASE; } # uses automatic channels configured in restored control file RESTORE DATABASE UNTIL SEQUENCE 13243; RECOVER DATABASE UNTIL SEQUENCE 13243; # recovers to latest archived log

5. If recovery was successful, then open the database and reset the online logs:
6. ALTER DATABASE OPEN RESETLOGS;

How enable case sensitive password in 11g?

The SEC_CASE_SENSITIVE_LOGON initialization parameter gives the facility of case sensitive passwords. To enable/disable case sensitive password feature on existing applications, you can use the ALTER SYSTEM command. SHOW PARAMETER SEC_CASE_SENSITIVE_LOGON NAME TYPE VALUE ------------------------------------ ----------- -----------------------------sec_case_sensitive_logon boolean TRUE

ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = FALSE/TRUE; =================================== ===================================================================================================

How to Shrink Temporary Tablespace in Oracle11g


Oracle 11g has a new view called DBA_TEMP_FREE_SPACE that displays information about temporary tablespace usage. SELECT * FROM dba_temp_free_space; With this information, you can perform an online shrink of a temporary tablespace using the ALTER TABLESPACE command. ALTER TABLESPACE <Temp Tablespacename> SHRINK SPACE KEEP 40M; The shrink can also be directed to a specific tempfile using the TEMPFILE clause. ALTER TABLESPACE temp SHRINK TEMPFILE <File Name> KEEP 30M; The KEEP clause specifies the minimum size of the tablespace or tempfile. If this is omitted, the database will shrink the tablespace or tempfile to the smallest possible size. ALTER TABLESPACE temp SHRINK SPACE;

What is RAC? RAC stands for Real Application cluster. It is a clustering solution from Oracle Corporation that ensures high availability of databases by providing instance failover, media failover features. Mention the Oracle RAC software components:Oracle RAC is composed of two or more database instances. They are composed of Memory structures and background processes same as the single instance database.Oracle RAC instances use two processes GES(Global Enqueue Service), GCS(Global Cache Service) that enable cache fusion.Oracle RAC instances are composed of following background processes: ACMSAtomic Controlfile to Memory Service (ACMS) GTX0-jGlobal Transaction Process LMONGlobal Enqueue Service Monitor

LMDGlobal Enqueue Service Daemon LMSGlobal Cache Service Process LCK0Instance Enqueue Process RMSnOracle RAC Management Processes (RMSn) RSMNRemote Slave Monitor What is GRD? GRD stands for Global Resource Directory. The GES and GCS maintains records of the statuses of each datafile and each cahed block using global resource directory.This process is referred to as cache fusion and helps in data integrity. Give Details on Cache Fusion:Oracle RAC is composed of two or more instances. When a block of data is read from datafile by an instance within the cluster and another instance is in need of the same block,it is easy to get the block image from the insatnce which has the block in its SGA rather than reading from the disk. To enable inter instance communication Oracle RAC makes use of interconnects. The Global Enqueue Service(GES) monitors and Instance enqueue process manages the cahce fusion. Give Details on ACMS:ACMS stands for Atomic Controlfile Memory Service.In an Oracle RAC environment ACMS is an agent that ensures a distributed SGA memory update(ie)SGA updates are globally committed on success or globally aborted in event of a failure.

Give details on GTX0-j :The process provides transparent support for XA global transactions in a RAC environment.The database autotunes the number of these processes based on the workload of XA global transactions. Give details on LMON:This process monitors global enques and resources across the cluster and performs global enqueue recovery operations.This is called as Global Enqueue Service Monitor. Give details on LMD:This process is called as global enqueue service daemon. This process manages incoming remote resource requests within each instance. Give details on LMS:This process is called as Global Cache service process.This process maintains statuses of

datafiles and each cahed block by recording information in a Global Resource Dectory(GRD).This process also controls the flow of messages to remote instances and manages global data block access and transmits block images between the buffer caches of different instances.This processing is a part of cache fusion feature. Give details on LCK0:This process is called as Instance enqueue process.This process manages non-cache fusion resource requests such as libry and row cache requests. Give details on RMSn:This process is called as Oracle RAC management process.These pocesses perform managability tasks for Oracle RAC.Tasks include creation of resources related Oracle RAC when new instances are added to the cluster. Give details on RSMN:This process is called as Remote Slave Monitor.This process manages background slave process creation andd communication on remote instances. This is a background slave process.This process performs tasks on behalf of a co-ordinating process running in another instance. What components in RAC must reside in shared storage? All datafiles, controlfiles, SPFIles, redo log files must reside on cluster-aware shred storage. What is the significance of using cluster-aware shared storage in an Oracle RAC environment? All instances of an Oracle RAC can access all the datafiles,control files, SPFILE's, redolog files when these files are hosted out of cluster-aware shared storage which are group of shared disks.

Give few examples for solutions that support cluster storage:ASM(automatic storage management),raw disk devices,network file system(NFS), OCFS2 and OCFS(Oracle Cluster Fie systems). What is an interconnect network? an interconnect network is a private network that connects all of the servers in a cluster. The interconnect network uses a switch/multiple switches that only the nodes in the cluster can access.
How can we configure the cluster interconnect? Configure User Datagram Protocol(UDP) on Gigabit ethernet for cluster interconnect.On unia and linux systems we use UDP and RDS(Reliable data socket) protocols to be used by Oracle Clusterware.Windows clusters use the TCP protocol. Can we use crossover cables with Oracle Clusterware interconnects?

No, crossover cables are not supported with Oracle Clusterware intercnects. What is the use of cluster interconnect? Cluster interconnect is used by the Cache fusion for inter instance communication. How do users connect to database in an Oracle RAC environment? Users can access a RAC database using a client/server configuration or through one or more middle tiers ,with or without connection pooling.Users can use oracle services feature to connect to database. What is the use of a service in Oracle RAC environemnt? Applications should use the services feature to connect to the Oracle database.Services enable us to define rules and characteristics to control how users and applications connect to database instances. What are the characteriscs controlled by Oracle services feature? The charateristics include a unique name, workload balancing and failover options,and high availability characteristics. Which enable the load balancing of applications in RAC? Oracle Net Services enable the load balancing of application connections across all of the instances in an Oracle RAC database. What is a virtual IP address or VIP? A virtl IP address or VIP is an alternate IP address that the client connectins use instead of the standard public IP address. To configureVIP address, we need to reserve a spare IP address for each node, and the IP addresses must use the same subnet as the public network. What is the use of VIP? If a node fails, then the node's VIP address fails over to another node on which the VIP address can accept TCP connections but it cannot accept Oracle connections. Give situations under which VIP address failover happens:VIP addresses failover happens when the node on which the VIP address runs fails, all interfaces for the VIP address fails, all interfaces for the VIP address are disconnected from the network. What is the significance of VIP address failover? When a VIP address failover happens, Clients that attempt to connect to the VIP address receive a rapid connection refused error .They don't have to wait for TCP connection timeout messages.

What are the administrative tools used for Oracle RAC environments? Oracle RAC cluster can be administered as a single image using OEM(Enterprise Manager),SQL*PLUS,Servercontrol(SRVCTL),clusterverificationutility(cvu),DBCA,NE TCA How do we verify that RAC instances are running? Issue the following query from any one node connecting through SQL*PLUS. $connect sys/sys as sysdba SQL>select * from V$ACTIVE_INSTANCES; The query gives the instance number under INST_NUMBER column,host_:instancename

under INST_NAME column. What is FAN? Fast application Notification as it abbreviates to FAN relates to the events related to instances,services and nodes.This is a notification mechanism that Oracle RAc uses to notify other processes about the configuration and service level information that includes service status changes such as,UP or DOWN events.Applications can respond to FAN events and take immediate action. Where can we apply FAN UP and DOWN events? FAN UP and FAN DOWN events can be applied to instances, services and nodes. State the use of FAN events in case of a cluster configuration change? During times of cluster configuration changes,Oracle RAC high availability framework publishes a FAN event immediately when a state change occurs in the cluster.So applications can receive FAN events and react immediately.This prevents applications from polling database and detecting a problem after such a state change. Why should we have seperate homes for ASm instance? It is a good practice to have ASM home seperate from the database hom(ORACLE_HOME).This helps in upgrading and patching ASM and the Oracle database software independent of each other.Also,we can deinstall the Oracle database software independent of the ASM instance. What is the advantage of using ASM? Having ASM is the Oracle recommended storage option for RAC databases as the ASM maximizes performance by managing the storage configuration across the disks.ASM does this by distributing the database file across all of the available storage within our cluster database environment. What is rolling upgrade? It is a new ASM feature from Database 11g.ASM instances in Oracle database 11g release(from 11.1) can be upgraded or patched using rolling upgrade feature. This enables us to patch or upgrade ASM nodes in a clustered environment without affecting database availability.During a rolling upgrade we can maintain a functional cluster while one or more of the nodes in the cluster are running in different software versions.

http://neworacledba.blogspot.com State the initialization parameters that must have same value for every instance in an Oracle RAC database:Some initialization parameters are critical at the database creation time and must have same values. Their value must be specified in SPFILE or PFILE for every instance.The list of parameters that must be identical on every instance are given below: ACTIVE_INSTANCE_COUNT ARCHIVE_LAG_TARGET COMPATIBLE CLUSTER_DATABASE

CLUSTER_DATABASE_INSTANCE CONTROL_FILES DB_BLOCK_SIZE DB_DOMAIN DB_FILES DB_NAME DB_RECOVERY_FILE_DEST DB_RECOVERY_FILE_DEST_SIZE DB_UNIQUE_NAME INSTANCE_TYPE (RDBMS or ASM) PARALLEL_MAX_SERVERS REMOTE_LOGIN_PASSWORD_FILE UNDO_MANAGEMENT Can the DML_LOCKS and RESULT_CACHE_MAX_SIZE be identical on all instances? These parameters can be identical on all instances only if these parameter values are set to zero. What two parameters must be set at the time of starting up an ASM instance in a RAC environment?The parameters CLUSTER_DATABASE and INSTANCE_TYPE must be set. Mention the components of Oracle clusterware:Oracle clusterware is made up of components like voting disk and Oracle Cluster Registry(OCR). What is a CRS resource? Oracle clusterware is used to manage high-availability operations in a cluster.Anything that Oracle Clusterware manages is known as a CRS resource.Some examples of CRS resources are database,an instance,a service,a listener,a VIP address,an application process etc. What is the use of OCR? Oracle clusterware manages CRS resources based on the configuration information of CRS resources stored in OCR(Oracle Cluster Registry). How does a Oracle Clusterware manage CRS resources? Oracle clusterware manages CRS resources based on the configuration information of CRS resources stored in OCR(Oracle Cluster Registry). Name some Oracle clusterware tools and their uses? OIFCFG - allocating and deallocating network interfaces OCRCONFIG - Command-line tool for managing Oracle Cluster Registry OCRDUMP - Identify the interconnect being used CVU - Cluster verification utility to get status of CRS resources What are the modes of deleting instances from ORacle Real Application cluster

Databases? We can delete instances using silent mode or interactive mode using DBCA(Database Configuration Assistant). How do we remove ASM from a Oracle RAC environment? We need to stop and delete the instance in the node first in interactive or silent mode.After that asm can be removed using srvctl tool as follows: srvctl stop asm -n node_name srvctl remove asm -n node_name We can verify if ASM has been removed by issuing the following command: srvctl config asm -n node_name How do we verify that an instance has been removed from OCR after deleting an instance? Issue the following srvctl command: srvctl config database -d database_name cd CRS_HOME/bin ./crs_stat How do we verify an existing current backup of OCR? We can verify the current backup of OCR using the following command : ocrconfig -showbackup What are the performance views in an Oracle RAC environment? We have v$ views that are instance specific. In addition we have GV$ views called as global views that has an INST_ID column of numeric data type.GV$ views obtain information from individual V$ views. What are the types of connection load-balancing? There are two types of connection load-balancing:server-side load balancing and client-side load balancing.What is the differnece between server-side and client-side connection load balancing? Client-side balancing happens at client side where load balancing is done using listener.In case of server-side load balancing listener uses a load-balancing advisory to redirect connections to the instance providing best service.

How to rename a disk group? in 11gR2


The new command line interface renamedg can be used to rename a diskgroup. Before we can rename a diskgroup is must be dismounted on all cluster nodes. Renaming a diskgroup is a two step operation: First it is necessary to create a configuration file:

$ renamedg -phase one - MY_OLD_DiskGroup MYOLDDG -newdgname MY_NEW_DiskGroup -config /tmp/my_newdg.conf


As the second step we use the configuration file by running the following command:

$ renamedg -phase two -config /tmp/my_newdg.conf


================================================================================ == ===============================================================================

How to change Database ID by using NID utility?


Change Only the DBID (Database ID) ==================== 1. Backup the database 2. SHUTDOWN IMMEDIATE of the database 3. STARTUP MOUNT 4. Open one session and run NID with sysdba privileges % nid TARGET=SYS/password@test_db 5. Shutdown IMMEDIATE of the database 6. Set the DB_NAME initialization parameter in the initialization parameter file to the new database name 7. Create a new password file 8. Startup of the database with open resetlogs Example: ======== 1. C:\>set ORACLE_SID=TEST1BY C:\>sqlplus "/as sysdba" SQL*Plus: Release 9.2.0.1.0 - Production on Tue Dec 24 11:16:52 2002 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to an idle instance. SQL> startup pfile=D:\oracle\admin\TEST1BY\pfile\initTEST1BY.ora ORACLE instance started. Total System Global Area 135338868 bytes Fixed Size 453492 bytes Variable Size 109051904 bytes Database Buffers 25165824 bytes Redo Buffers 667648 bytes Database mounted. Database opened. 2. check the DBID before change SQL> select dbid,name,open_mode,activation#,created from v$database; DBID NAME OPEN_MODE ACTIVATION# CREATED ---------- --------- ---------- ----------- --------1395399949 TEST1BY READ WRITE 1395404134 10-SEP-02 3. SQL> shutdown immediate;

Database closed. Database dismounted. ORACLE instance shut down. 4. SQL> startup mount pfile=D:\oracle\admin\TEST1BY\pfile\initTEST1BY.ora ORACLE instance started. Total System Global Area 135338868 bytes Fixed Size 453492 bytes Variable Size 109051904 bytes Database Buffers 25165824 bytes Redo Buffers 667648 bytes Database mounted. SQL>exit 5. execute NID C:\>nid target=sys/oracle@TEST1BY DBNEWID: Release 9.2.0.1.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. Connected to database TEST1BY (DBID=1395399949) Control Files in database: D:\ORACLE\BASE_TEST\TEST1BYCONTROL01.CTL Change database ID of database TEST1BY? (Y/[N]) => y Proceeding with operation Changing database ID from 1395399949 to 1397190693 Control File D:\ORACLE\BASE_TEST\TEST1BYCONTROL01.CTL - modified Datafile D:\ORACLE\BASE_TEST\TEST1BY\SYSTEM01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\UNDOTBS01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\DRSYS01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\EXAMPLE01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\INDX01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\TOOLS01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\USERS01.DBF - dbid changed Datafile D:\ORACLE\BASE_TEST\TEST1BY\XDB01.DBF - dbid changed Control File D:\ORACLE\BASE_TEST\TEST1BYCONTROL01.CTL - dbid changed Database ID for database TEST1BY changed to 1397190693. All previous backups and archived redo logs for this database are unusable. Shut down database and open with RESETLOGS option. Succesfully changed database ID. DBNEWID - Completed succesfully. 6. SQL> shutdown immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down. 7. create the new passwordfile 8. SQL> startup mount pfile=D:\oracle\admin\TEST1BY\pfile\initTEST1BY.ora

ORACLE instance started. Total System Global Area 135338868 bytes Fixed Size 453492 bytes Variable Size 109051904 bytes Database Buffers 25165824 bytes Redo Buffers 667648 bytes Database mounted. 9. SQL> alter database open resetlogs; Database altered. 10. check the new DBID SQL> select dbid,name,open_mode,activation#,created from v$database; DBID NAME OPEN_MODE ACTIVATION# CREATED ---------- --------- ---------- ----------- --------1397190693 TEST1BY READ WRITE 1397188261 10-SEP-02 NOTE: The NID change the OLD DBID 1395399949 to the NEW DBID 1397190693

How do you know the index fragmented? First analyze index


SQL>analyze index INDEX_NAME validate structure;

Then query INDEX_STATS view 1. If del_lf_rows/lf_rows is > .2 then index should be rebuild. 2. If height is 4 then index should be rebuild. 3. If lf_rows is lower than lf_blks then index should be rebuild.

SQL> column status format a10 SQL> select trunc((del_lf_rows/lf_rows)*100,2)||'%' "status" from index_stats; status ---------21.83%

How to remove index fragmentation? There are two way to remove fragmentation. 1. index coalesce 2. index rebuild What is difference between coalesce and rebuild please go through below link for more details http://download.oracle.com/docs/cd/B14117_01/server.101/b10739/indexes.htm# g1007548

SQL> alter index IDX_OBJ_ID coalesce; SQL> alter index IDX_OBJ_ID rebuild; SQL> alter index IDX_OBJ_ID rebuild online;

Note: If any DML statement is running on base table then we have to use ONLINE keyword with index rebuilding.

SQL> analyze index idx_obj_id validate structure; Index analyzed. SQL> select trunc((del_lf_rows/lf_rows)*100,2)||'%' "status" from index_stats; status ------40.85% SQL> alter index IDX_OBJ_ID rebuild online;

Index altered. SQL> analyze index idx_obj_id validate structure; Index analyzed. SQL> select trunc((del_lf_rows/lf_rows)*100,2)||'%' "status" from index_stats; status -------0%

When performing a database export, the export takes a long time when exporting stored procedures.?
This occurs due to a sub-optimal plan being chosen by the cost based optimizer in 9.2. There is no patch available for this however it can be worked around by setting _OPTIMIZER_UNDO_COST_CHANGE to 9.0.1 in the instance, e.g.: connect / as sysdba alter system set "_optimizer_undo_cost_change"=9.0.1 scope=memory; exit Alternatively you can set OPTIMIZER_FEATURES_ENABLED to 8.1.7, however this affects all queries performed in the database and so can impact application performance also.Lilly BO15

How to reload DATAPUMP utility?


In some cases DataPump utility may get corrupted and we need to recreate DataPump utility to overcome internal corruption. To do this, you need to run a set of scripts as given below. Note: Run the following as sysdba user: SQL> connect / as sysdba For Oracle version 10.1 : 1. Catdp.sql orders the installation of all its components including the Metadata API which was previously installed separately. By default catproc.sql invoke this script.SQL >@ $ORACLE_HOME/rdbms/admin/catdp.sql2. dbmspump.sql will create DBMS procedures for dataPUMPSQL >@ $ORACLE_HOME/rdbms/admin/dbmspump.sql

For Oracle version 10.2 : 1. Catdph.sql will Re-Install DataPump types and viewsSQL >@ $ORACLE_HOME/rdbms/admin/catdph.sql Note: If XDB is installed the it is required to run "catmetx.sql" script also. 2. prvtdtde.plb will Re-Install tde_library packagesSQL >@ $ORACLE_HOME/rdbms/admin/prvtdtde.plb 3. Catdpb.sql will Re-Install DataPump packagesSQL >@ $ORACLE_HOME/rdbms/admin/catdpb.sql 4.Dbmspump.sql will Re-Install DBMS DataPump objectsSQL >@ $ORACLE_HOME/rdbms/admin/dbmspump.sql 5. To recompile invalid objects, if anySQL >@ $ORACLE_HOME/rdbms/admin/utlrp.sql

Read-Only Tables in Oracle Database 11g?


In previous Oracle releases, tables could be made to appear read-only to other users by only granting the SELECT object privilege to them, but the tables remained read-write for the owner. Oracle 11g allows tables to be marked as read-only using the ALTER TABLE command. ALTER TABLE table_name READ ONLY; ALTER TABLE table_name READ WRITE; The following script creates a table, inserts a row, then sets the table to read-only. CREATE TABLE ro_tab ( id NUMBER ); INSERT INTO ro_tab VALUES (1); ALTER TABLE ro_tab READ ONLY; Any DML statements that affect the table data and SELECT ... FOR UPDATE queries result in an ORA12081 error message. SQL> INSERT INTO ro_tab VALUES (2); INSERT INTO ro_tab VALUES (2) * ERROR at line 1: ORA-12081: update operation not allowed on table "TEST"."RO_TAB" SQL> UPDATE ro_tab SET id = 2; UPDATE ro_tab SET id = 2 * ERROR at line 1: ORA-12081: update operation not allowed on table "TEST"."RO_TAB" SQL> DELETE FROM ro_tab; DELETE FROM ro_tab *

ERROR at line 1: ORA-12081: update operation not allowed on table "TEST"."RO_TAB" DDL statements that affect the table data are also restricted. SQL> TRUNCATE TABLE ro_tab; TRUNCATE TABLE ro_tab * ERROR at line 1: ORA-12081: update operation not allowed on table "TEST"."RO_TAB" SQL> ALTER TABLE ro_tab ADD (description VARCHAR2(50)); ALTER TABLE ro_tab ADD (description VARCHAR2(50)) * ERROR at line 1: ORA-12081: update operation not allowed on table "TEST"."RO_TAB" Operations on indexes associated with the table are unaffected by the read-only state. DML and DDL operations return to normal once the table is switched back to read-write mode. SQL> ALTER TABLE ro_tab READ WRITE; Table altered. SQL> DELETE FROM ro_tab; 1 row deleted. Lilly BF F

1.Rac configuration :

2. Utilities 3.Tasks 4.Resume 5.FAQs 6.Mislanious. 1. /etc/iscsi.conf Discoveryaddress=192.168.2.200 # common storage address.

2./etc/hosts Mention the vip, public IP and private IP . 3./etc/sysctl.conf (kernel parameters) 4.sysctl p ( to check the kernel parameters). 5. etc/security /limits 6.Install the rpms rpm -ihv to install rpm e to uninstall

rpm aq| grep <rpm name> 7./etc/modprob.conf (hang check timer) 8./etc/rc.local Sbin/modprobe hangcheck-timer 9.configure the system services.

10.creation of groups Dba,oinstall user oracle

10.Enabling ssh between the nodes. 11.date and time configuration in nodes. 12.user equilance

Vous aimerez peut-être aussi