Saturday, February 6, 2010

Flashback Table in 10g

Reinstating an accidentally dropped table is effortless using the Flashback Table feature in Oracle Database 10g

Here's a scenario that happens more often than it should: a user drops a very important table--accidentally, of course--and it needs to be revived as soon as possible. (In some cases, this unfortunate user may even have been you, the DBA!)

Oracle9i Database introduced the concept of a Flashback Query option to retrieve data from a point in time in the past, but it can't flash back DDL operations such as dropping a table. The only recourse is to use tablespace point-in-time recovery in a different database and then recreate the table in the current database using export/import or some other method. This procedure demands significant DBA effort as well as precious time, not to mention the use of a different database for cloning.

Enter the Flashback Table feature in Oracle Database 10g, which makes the revival of a dropped table as easy as the execution of a few statements. Let's see how this feature works.

See this,
SQL> drop table test;
We can see that particular table in recyclebin

SQL> show recyclebin;
We can recover that table simply by Flashback command:
SQL> FLASHBACK TABLE RECYCLETEST TO BEFORE DROP;
After that check the Table by
SQL>select * from tab;
We can see that table came back

Cheers!

Automatic Storage Management (ASM) in Oracle Database 10g

Automatic Storage Management (ASM) is a new feature that has be introduced in Oracle 10g to simplify the storage of Oracle datafiles, controlfiles and logfiles


Overview of Automatic Storage Management (ASM)Automatic Storage Management (ASM)

simplifies administration of Oracle related files by allowing the administrator to reference disk groups rather than individual disks and files, which are managed by ASM. The ASM functionality is an extention of the Oracle Managed Files (OMF) functionality that also includes striping and mirroring to provide balanced and secure storage. The new ASM functionality can be used in combination with existing raw and cooked file systems, along with OMF and manually managed files.
The ASM functionality is controlled by an ASM instance. This is not a full database instance, just the memory structures and as such is very small and lightweight.
The main components of ASM are disk groups, each of which comprise of several physical disks that are controlled as a single unit. The physical disks are known as ASM disks, while the files that reside on the disks are know as ASM files. The locations and names for the files are controlled by ASM, but user-friendly aliases and directory structures can be defined for ease of reference.
The level of redundancy and the granularity of the striping can be controlled using templates. Default templates are provided for each file type stored by ASM, but additional templates can be defined as needed.
Failure groups are defined within a disk group to support the required level of redundancy. For two-way mirroring you would expect a disk group to contain two failure groups so individual files are written to two locations.

Manages groups of disks, called disk groups. Manages disk redundancy within a disk group. Provides near-optimal I/O balancing without any manual tuning. Enables management of database objects without specifying mount points and filenames. Supports large files.

Initialization Parameters and ASM Instance CreationThe initialization parameters that are of specific interest for an ASM instance are:
INSTANCE_TYPE - Set to ASM or RDBMS depending on the instance type. The default is RDBMS. DB_UNIQUE_NAME - Specifies a globally unique name for the database. This defaults to +ASM but must be altered if you intend to run multiple ASM instances.

ASM_POWER_LIMIT -The maximum power for a rebalancing operation on an ASM instance. The valid values range from 1 to 11, with 1 being the default. The higher the limit the more resources are allocated resulting in faster rebalancing operations. This value is also used as the default when the POWER clause is omitted from a rebalance operation.
ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM instance during instance startup, or by the ALTER DISKGROUP ALL MOUNT statement. ASM configuration changes are automatically reflected in this parameter.
ASM_DISKSTRING - Specifies a value that can be used to limit the disks considered for discovery. Altering the default value may improve the speed of disk group mount time and the speed of adding a disk to a disk group. Changing the parameter to a value which prevents the discovery of already mounted disks results in an error. The default value is NULL allowing all suitable disks to be considered.

Application Database Administrator (ADBA)

Application DBA's or ADBA's are responsible for looking after the application tasks pertaining to a specific application.

This includes the creation of database objects, snapshots, SQL tuning, etc.

Typical ADBA responsibilities:
* Implement and maintain the database design
* Create database objects (tables, indexes, etc.)
* Write database procedures, functions and triggers
* Assist developers with database activities
* Tune database queries
* Monitor application related jobs and data replication activities

Generic Responsibilities

1)Complete time sheets
2)Document work performed
3)Interview new candidates

Oracle DBA Qualifications

Must be certified as an Oracle DBA.
Hardworking mentality
Lots and lots of EXPERIENCE

Oracle DBA Skill Set

1)Good understanding of the Oracle database, related utilities and tools
2)A good understanding of the underlying operating systemA good knowledge of the physical database design
3)Ability to perform both Oracle and operating system performance tuning and monitoring Knowledge of ALL Oracle backup and recovery scenarios
4) A good knowledge of Oracle security managementA good knowledge of how Oracle acquires and manages resources
5)A good knowledge Oracle data integritySound knowledge of the implemented application systemsExperience in code migration, database change management and data management through the various stages of the development life cycle
6)A sound knowledge of both database and system performance tuningA DBA should have sound communication skills with management, development teams, vendors and systems administratorsProvide a strategic database direction for the organisation.
7)A DBA should have the ability to handle multiple projects and deadlinesA DBA should possess a sound understanding of the business

Oracle DBA Roles and Responsibilities

The job of the DBA seems to be everything that everyone else either doesn't want to do, or doesn't have the ability to do. DBAs get the enviable task of figuring out all of the things no one else can figure out. More seriously though, here is a list of typical DBA responsibilities:
Installation, configuration and upgrading of Oracle server software and related products Evaluate Oracle features and Oracle related products Establish and maintain sound backup and recovery policies and procedures Take care of the Database design and implementation Implement and maintain database security (create and maintain users and roles, assign privileges) Perform database tuning and performance monitoring Perform application tuning and performance monitoring Setup and maintain documentation and standards Plan growth and changes (capacity planning) Work as part of a team and provide 7x24 support when required Perform general technical trouble shooting and give consultation to development teams Interface with Oracle Corporation for technical support. Patch Management and Version Control

Tablespace Quota

We can see the tablespace quota of particular users by
USER_TS_QUOTAS

Thursday, February 4, 2010

Change NonArchive Mode to Archive Mode

Archive Mode is very important.Archive files are the online backup of Redo log files.
Change the mode
Shutdown the database by SHUTDOWN NORMAL OR SHUTDOWN IMMEDIATE;
then
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
Enabling Automatic Archival
by
ALTER SYSTEM SET LOG_ARCHIVE_START=TRUE SCOPE=SPFILE;
then
SHUTDOWN DATABASE;
then
STARTUP

We can check the log mode by issue
SELECT LOG_MODE FROM V$DATABASE;

We can see the log mode and current sequence number by
ARCHIVE LOG LIST;