Wednesday, April 28, 2010

Oracle Grid- Creating User Accounts

Hello,

I am going to discuss more about Oracle Grid - creating administrator user, super administrator user, creating targets, generating reports, scheduling jobs, setting alerts,setting email notification and so on.
In this post i am going to create two administrator user accounts (warning_admin, critical_admin) and super administrator user account (super_admin) using Oracle Grid.
Administrator User Accounts: Adminsitrator are deatabase users defined in the management repository who can log into Enterprise Manager to perform management tasks.
Super Administrator User Account:The Super Administrator can choose to grant certain privileges to certain administrators to access and manage certain targets based on the requirement. Thus, the superadministrator can divide the work intelligently among the adminsitrators.

Creating Super Administrator User Super_Admin using Oracle Grid
Super_Admin
• Go to Setup -> click on Administrators
• Click Createlike -> provide the following information
• Name: Super_Admin
• Password:
• Confirm password:
• Check on Super Administrator
• Click Finish

Creating Adminsitrator User Accounts Warning_Admin and Critical_Admin

Warning_Admin
Login to Grid user Super Administrator user account Super_Admin
Create 2 User Accounts
Note: This 2 users are created just to differentiate critical alerts and warning alerts and set email notifications to groups based on the priority. It is sometimes needed to avoid your boss getting all warning emails, so make sure that you have 2 email groups with your boss included in criticals alerts and not in warning alerts.
Warning_Admin: This account is created to set for all the alerts which come under warning messages. A warning email is sent to everyone in the team except your Boss.
• Go to setup -> Adminitrators
• Click on Createlike -> Provide following information
• Name: warning_admin
• Password:
• Confirm Password:
• Email:
• Don’t check on super administrator
• Click next Roles Page
• Make the role as public
• Click next to system privileges
• Check on view any target
• Click next to Target
• Browse Type-> All target type and move all to selected targets
• Click next to target privileges
• Click next to Review and click Finish

Critical_Admin
Login into Oracle Grid using Super_Admin
Create administrator user Critical_Admin
Critical_Admin: This account is created to set for all the alerts which come under critical messages. A Critical email is sent to everyone in the team including your Boss. The critical email is .......
• Go to setup -> Administrators
• Click on createlike -> Provide following information
• Name: critical_admin
• Password:
• Confirm Password:
• Email:
• Don’t check on super administrator
• Click next roles Page
• Make the role as Public
• Click Next to system privileges
• Check on view any target
• Click next to Target
• Browse Type -> All target type and move all to selected targets
• Click next to target privileges
• Click next to Review and click finish

Regards,
Sowmya (OSR)

Tuesday, April 20, 2010

RMAN- Block Change Tracking

Hello,
Block Change Tracking
As data blocks changes, the background process change tracking writer (CTWR) tracks all the changes made to the data block in a private area of memory. When we issue commit on these changes, the block change tracking information is copied to a shared area in large pool called the CTWR buffer. CTWR process writes the information from the CTWR RAM buffer to the change tracking file. Without BCT enabled or in cases when change tracking information cannot be used, RMAN has to read every block in the datafile during incremental backup. Each block contains last system change number (SCN) of its last modification. The block is copied only if its SCN is higher or equal to the base backup SCN. To be precise, the backup SCN is a checkpoint SCN that was made right before the backup. Since, usually, only handful of blocks is changed between incremental backups, RMAN does a lot of useless work reading the blocks not required for backup.
Block change tracking provides a way to identify the blocks required for backup without scanning the whole datafile. After that RMAN need only read blocks that are really required for this incremental backup.

How to Enable/Disable Block change tracking?
Enable
Syntax: SQL>Alter database enable block change tracking (syntax when OMF is enabled)
Or
Alter database enable block change tracking using file os_file_name;
Using os_file_name syntax allows you to define the location of the change tracking file on the OS or you can omit this using OMF (oracle Managed files)
By default the change tracking file is created as an Oracle Managed File (OMF) in the location pointed to by the DB_CREATE_FILE_DEST parameter.
Disable
SQL>alter database disable block change tracking;

How to monitor the status of block change tracking?
SQL>select filename, status, bytes from v$block_change_tracking

How can we view the size of CTWR dba buffer?
Select * from v$sgastat where name like ‘CTWR%’;

Regards,
Sowmya (OSR)

Monday, April 19, 2010

RMAN-Incremental Backup

Hello,
Incremental Backups using RMAN:

Incremental Backups: RMAN incremental backups back up only data file block that have been changed since last backup. One can make incremental backups at Database level, Tablespace level or datafile level.
The main theme of incremental backup is to back up only those data blocks that have been changed since previous backup.
The reasons for going incremental backup as a part of our backup strategy are:
1. To reduce the amount of time needed for taking backups.
2. To save network bandwidth when backing up over network.
3. For better backup performance.
4. To reduce backup size for Non-Archive log databases, instead of going with full database backup one can go with incremental backups.

Incremental Backup Algorithm:
Data is stored in the data blocks. Each data block in a data file contains system change number SCN, which is the SCN at which most recent changes are made to the block. During incremental backup RMAN reads the SCN of each data block in the input file and compares this with the checkpoint SCN of the parent incremental backup. If the SCN in the input data block Is greater than or equal to the checkpoint SCN of the parent, then RMAN copies the block.

Level 0 and Level 1 Backups:
Level 0: Level 0 is just like a full backup which is the base of the subsequent incremental backups, copies all blocks containing data, backing the data file up into a backup set.
The main difference between the full backup and incremental level 0 backups is , full backup is never included in the incremental backup strategy.
Level 1: With reference to the previous level 0 backup or level 1 backup it backs up the modified data blocks.

Types of Level 1 incremental backups:
Differential Backup: Backus up all blocks changed after the most recent incremental backup at level 1 or 0
Cumulative backup: Backups up all blocks changed after the most recent incremental backup at level 0
By default incremental backups are differential.
RMAN> Backup Incremental level 1 Database; (example of differential backup)
RMAN> Backup Incremental level 1 cumulative database; (blocks changed since level 0- Cumulative Incremental Backups.

Incremental Backup Strategy:
Choose a backup schema according to an acceptable MTTR (mean time to recover). For example, you can implement a three –level backup schema so that a full or level 0 backup is taken monthly, a cumulative level 1 is taken weekly, and a differential level 1 is taken daily.

How often we can take full or incremental backups?
When deciding how often we can take full or incremental backups, a good rule of thumb is to take a new level 0 backup whenever 50% or more of the data has changed. If the rate of change to your database is predictable, then you can observe the size of your incremental backups to determine new level 0 is appropriate.
The following query will help you to determine the rate of changed blocks.

SELECT FILE#, INCREMENTAL_LEVEL, COMPLETION_TIME, BLOCKS, DATAFILE_BLOCKS
FROM V$BACKUP_DATAFILE
WHERE INCREMENTAL_LEVEL > 0
AND BLOCKS / DATAFILE_BLOCKS > .5
ORDER BY COMPLETION_TIME;

Making Incremental Backups : Backup Incremental
After starting RMAN, run the BACKUP INCREMENTAL command at the RMAN prompt. This example makes a level 0 incremental backup of the database:
BACKUP INCREMENTAL LEVEL 0 DATABASE;
This example makes a differential level 1 backup of the SYSTEM tablespace and datafile tools01.dbf. It will only back up those data blocks changed since the most recent level 1 or level 0 backup:
BACKUP INCREMENTAL LEVEL 1
TABLESPACE SYSTEM
DATAFILE 'ora_home/oradata/trgt/tools01.dbf';
This example makes a cumulative level 1 backup of the tablespace users, backing up all blocks changed since the most recent level 0 backup.
BACKUP INCREMENTAL LEVEL = 1 CUMULATIVE
TABLESPACE users;

Regards,
Sowmya (OSR)
http://usdba.blogspot.com/2010/04/rman-incremental-backup.html

Thursday, April 1, 2010

RMAN -Practicals

Hello,
Connecting to RMAN
1.Open the DOS command prompt.
2.C:>rman
3.RMAN>
4.RMAN>exit
Connecting to the target database
1.Open the DOS command prompt.
2.C:>SET ORACLE_SID=kendb
3.RMAN> connect target
Or
rman target / NOCATALOG
Or
rman target/
4.RMAN>exit
Creating the Repository in the Recovery Catalog Database
RMAN repository in a separate database called RCMDB.
Add entry in tnsnames.ora file.
Make sure RCMDB is in ArchiveLog Mode.
Make sure Target Database (KENDB) is in archivelog mode.
1. sqlplus to RCMDB as SYSDBA
Set oracle_sid=RCMDB
Sqlplus “/as sysdba”
Sql>select name from v$database; (Verify you connected to rcmdb)
2. CREATE USER RMANUSER
IDENTIFIED BY RMANUSER
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP;
3. sql>grant connect, resource,recovery_catalog_owner to rmanuser;
4.sql>exit;
5. Invoke RMAN executable
RMAN
RMAN>connect catalog rmanuser/rmanuser@RCMDB
6. Create catalog for RMANUSER
RMAN>CREATE CATALOG;
7. RMAN>EXIT;
Connecting to Target and Recovery Catalog Database
1. C:>set oracle_sid=TESTDB
2. C:>RMAN
3. RMAN>CONNECT TARGET
4. RMAN>CONNECT CATALOG RMANUSER/RMANUSER@RCMDB
5. RMAN>EXIT;
Or
Instead or step3,4 and 5 You can use following:
C:>RMAN TARGET / CATALOG RMANUSER/RMANUSER@RCMDB
Registering the Target Database.
1. C:>SET ORACLE_SID=TESTDB
2. C:>RMAN
3. RMAN>CONNECT TARGET
4. RMAN>CONNECT CATALOG RMANUSER/RMANUSER@RCMDB
5. RMAN>REGISTER DATABASE;
6. RMAN>EXIT;
Setting the Retention Policy
1. Launch RMAN again
2. C:>rman target/
3. RMAN>configure retention policy to redundancy 2;
4. RMAN>show retention policy;
5. RMAN>configure retention policy to recovery window of 3 days;
6. RMAN>configure retention policy clear;
7. RMAN>exit;
Configuring the Default Device Type
1. C>rman target/
2. RMAN>configure default device type to sbt; (for tape)
3. RMAN>configure default device type to disk;
4. RMAN>show default device type;
5. RMAN>configure default device type clear;
6. RMAN>exit;
format for device type disk
Configuring Controlfile Autobackup
1. C>rman target/
2. RMAN>configure controlfile autobackup on;
3. RMAN> configure controlfile autobackup format for device type disk to 'f:\backup\kendb\rman\%F';
4. RMAN>show controlfile autobackup;
5. RMAN>show controlfile autobackup format;
6. RMAN>configure controlfile autobackup clear;
7. RMAN>configure controlfile autobackup format for device type disk clear;
8. RMAN>exit;
Configuring the Default Backup Type
1. C>rman target/
2. RMAN>configure device type disk backup type to backupset;
3. RMAN>configure device type disk backup type to copy;
4. RMAN>configure device type disk backup type to compressed backupset;
5. RMAN>show device type;
6. RMAN>backup database;
7. RMAN>list backup;
8. RMAN>configure device type disk clear;
9. RMAN>exit;
Parallelizing backups
1. C>set oracle_sid=kendb
2. C>rman target/
3. RMAN>configure device type disk parallelism 4;
4. RMAN>backup datafile 2, 3;
RMAN>exit
Backup entire Database
1. C>set oracle_sid=kendb
2. C>rman
3. RMAN>CONNECT TARGET
4. RMAN>CONNECT CATALOG RMANUSER/RMANUSER@RCMDB;
5. RMAN>CONFIGURE DEVICE TYPE DISK CLEAR;
6. RMAN>BACKUP DATABASE;
OR
7. RMAN> BACKUP DATABASE FORMAT ‘O:\ORABACKUP\KENDB\BACKUP.RMAN\db_%u_%d_%s_%p’;
OR
8. RMAN>BACKUP DATABASE MAXSETSIZE=500M;
9. RMAN>EXIT;
Backup Tablespace
1. C>set oracle_sid=kendb
2. C>rman target/
3. RMAN>backup tablespace system;
4. RMAN>backup tablespace system, sysaux;
Backup Datafile
1. C>set oracle_sid=kendb
2. C>rman target/
3. RMAN>report schema;
4. RMAN>backup datafile 3;
5. RMAN>backup datafile 2,4;
6. RMAN>exit;
Backup Controlfile
1. C>rman target/
2. RMAN>backup current controlfile;
3. RMAN>exit;
Creating Compressed Backups
1. C>set oracle_sid=kendb
2. C>rman target/
3. RMAN>backup as compressed backupset datafile 3;
RMAN>exit;
Backup ArchiveLogs
1. C>set oracle_sid=kendb
2. C>rman
3. RMAN>backup archivelog all;
OR
4. RMAN>backup archivelog all delete input;
(This deletes archivelog files after they have been backed up.)
5. Backup Archivelogs generated in the past 2 days.
6. RMAN>backup archivelog from time ‘sysdate-2’ until time ‘sysdate’;
7. RMAN>exit;
Performing Incremental Backups
1. C>set oracle_sid=kendb
2. C>rman target/
3. RMAN>backup incremental level 0 database;
Incremental backups may be taken at Tablespace or datafile level.
OR
4. RMAN>BACKUP INCREMENTAL LEVEL 0 DATAFILE 2, 4;
5. RMAN>BACKUP INCREMENTAL LEVEL 0 TABLESPACE USERS;
Create Incremental Level 1 backups
6. RMAN>backup incremental level 1 tablespace users;
7. RMAN>backup incremental level 1 database;
Create Cumulative Level 1 backups
8. RMAN>backup incremental level 1 cumulative tablespace users;
9. RMAN>backup incremental level 1 cumulative database;
10. RMAN>backup incremental level 1 cumulative datafile 2, 4;
11. RMAN>exit;
Create Image Copies
1. C>set oracle_sid=kendb
2. C>rman target/
3. RMAN>backup as copy database;
OR
4. RMAN>backup as copy tag “users_wkly_bkp” tablespace users;
OR
5. RMAN>backup as copy datafile 4;
6. RMAN>exit;
LIST COMMAND
Which backups are currently available.
1. C>set oracle_sid=kendb
2. C>rman target/
3. rman>list backup by backup;
4. rman>list backupset by backup;
5. rman>list backup by backup verbose;
6. rman>list backup by backup summary;
7. rman>list backup by file;
8. rman>list copy of database; image copies
9. rman>list copy of tablespace users;
10. rman>list copy of datafile 3;
11. rman>list incarnation; to view different incarnation
Identify files that are in need of backup
1. c>set oracle_sid=kendb
2. c>rman target/
3. rman>configure retention policy to redundancy 2;
4. rman> report need backup;
5. rman> report need backup days=7 database; files that need a minimum of 7 days of logfiles to be applied in the event of recovery.
6. rman>exit;
Report Obsolete
1. c>set oracle_sid=kendb
2. c> rman target/
3. rman> report obsolete;
4. rman> delete obsolete;
5. rman>exit;

Regards,
Sowmya (OSR)

RMAN -Introduction

Hello,
RMAN : Recovery Manager



RMAN Components

RMAN is an Oracle Utility that can backup, restore and recover database files. The RMAN executable is named rman and can be found in $ORACLE_HOME/bin directory and is installed by default with Oracle 10g, 9i and 8i Standard and Enterprise editions.

Every Target Database has to be registered in the catalog database. We can invoke command line executables from the operating system.

In case of cold and hot backup it is like blind backup or mirror image

i.e size of backup is equal to database size.

But in case of RMAN, t is content copy backup i.e only used blocks backup.


Example:

In 100 GB database only 60% are used blocks i.e used blocks =60 GB

In that 60 GB of used blocks, changed or modified blocks are of only 1 GB

Complete backup includes 60GB

Incremental backup includes 1GB.

Concepts:

1. RMAN keeps a record of all target databases that are registered with catalog database.

2. When RMAN is invoked to backup or recover a database, it verifies the largest database with stored database if available in the RMAN Catalog.

3. If its matches RMAN establishes two server session with target database.

4. A channel is a remote procedural call to the target database using pl/sql interace to perform backup and recovery operations.

5. RMAN Compiles the command and executed it on the target database with the summary of actions. Backedup to these files are called backup pieces. To backup to tape drive/tape library we need the media manager.

6. Execution of every RMAN backup command produces a backup set that is a logical grouping of one more physical files called backup pieces.

7. RMAN Backup s going to be content backup not mirror image but only used blocks are backed up. Thus RMAN is smaller and much faster when compared to other backups.

Advantages:

1. Centralized backup and recovery and this recovery is across enterprise database.

2. Incremental backups –only those blocks which are changed since last backup

3. Corrupt block identification

4. Automated scheduled backups

5. Cross check – Once backup is over again checking the consistency of original files.

6. Can generate logs on backup and recovery.

7. Can report the summary information.

8. Can store preconfigured scripts which can be run at any time.

9. A log can specify to the backup file / files set which can be used even at the time of restore instead of filename.

10. Tablespace point in time recovery is possible .

11. Create duplicate database of production database for developers /QA people/

12. Multiple destinations can be mentioned.

13. Cleanup procedures can be implemented after performing RMAN successful backup. let’s get rid of obsolete archive log files.


Pre –requirements:

1. Every Target must be registered in the catalog database

2. In the catalog database a separate tablespace must be created to hold catalog schema owner.

3. A user should be created in the catalog database with connect, resource, recovery_catalog_owner privileges.

 
Regards,
Sowmya (OSR)

Monday, March 8, 2010

Oracle V$ View's

Oracle’s V$Views


The following V$ Views are part of the data dictionary which are commonly used by DBA’s

One can view the columns of these views by

SQL>desc v$

1. V$archive_dest: Shows all archive redo log destinations. Use this view to find out which place archived redo logs are copied: select dest_id, destination from v$archive_dest.

2. V$archive_dest_status: this view allows to find status and error for each of the defined.

3. V$archived_log: Displays successfully archived redo logs.shows received logs on a primary standby database.

4. V$archive_gap: Lists sequence numbers of the archived logs that are known to be missing for each thread on a physical standby database (highest gap pnly)

5. V$archive_processes: This view provides information on the archive processes. It can be used to find out if an ARCH process is active or not.

6. V$Controlfile: Displays the location and status of each controlfile in the database.

7. V$bh: This dynamic view has an entry for each block in the database buffer cache.

The column status can be:

Free:This block is not in use

Xcur:Block held exclusively by this instance

Scur:Block held in cache, shared with other instance

Cr:Block for consistent read

Read:Block being read from disk

Mrec:Block in media recovery mode

Irec:Block in instance (crash) recovery mode

8. V$buffer_pool

9. V$buffer_pool_statistics

10. V$database: This views allows you to access database information. For example you can check whether the database is in archivelog mode or not.

SQL> select log_mode from v$database;

Log mode

Archivelog

11. V$datafile: This view contains an entry for each datafile of the database.

SQL> select name from v$datafile;

12. V$datafile_header:

13. V$dataguard_status: shows error messages in the dataguard environment.

14. V$db_object_cache:this view displays objects that are cached(pinned) in the library cache.

15. V$enqueue_stat: If there are a lot of enqueue waits in v$session_event or v$system_event, v$enqueue_stst allows to break down those enqueues in enqueue classes. For each such class, the gets, waits, failures and the cumulative sum of waited time can be found.

16. V$eventmetric: This view is new in Oracle 10g and allows improved timings and statistics.

17. V$event_name: Contains a record for each wait event

18. V$filemetric: This view is new in Oracle 10g and allows improved timings and statistics.

19. V$filestat

20. V$fixed_table: This view contains the name of all v$, GV$, X$ tables.

21. V$flash_recovery_area_usage: It contains following columns

File_type, percent_space_used, percent_space_reclaimabl,number_of_files.

22. V$instance: it contains information about instance. These are the columns present in v$instance—instance_number, instance_name,host_name,version,startup_time,status,paralled,thread#,archiver,log_switch_wait,logins,shutdown_pending, database_status,instance_status,instance_role, active_state,blocked.

23. V$instance_recovery: It can be used to determine the optimal size of the redo logs.

24. V$latch: Oracle collects statistics for the activity of all latches and stores these in this view. Gets is the number of successful willing to wait requests for a latch. Similarly, misses is how many times a process didn't successfully request a latch. Spin_gets: number of times a latch is obtained after spinning at least once. Sleeps indicates how many times a willing to wait process slept. Waiters_woken tells how often a sleeping process was 'disturbed'

25. V$librarycache

26. V$lock: This view stores all information relating to locks in the database. The interesting columns in this view are sid (identifying the session holding or aquiring the lock), type, and the lmode/request pair. Important possible values of type are TM (DML or Table Lock), TX (Transaction), MR (Media Recovery), ST (Disk Space Transaction). Exactly one of the lmode, request pair is either 0 or 1 while the other indicates the lock mode. If lmode is not 0 or 1, then the session has aquired the lock, while it waits to aquire the lock if request is other than 0 or 1. The possible values for lmode and request are: null, row share(SS), Row Exclusive (SX), share(S), Sahre Row Exclusive (SSX) and Exclusive (X). If the lock type is TM, the column id1 is the object's id and the name of the object can then be queried like so: select name from sys.obj$ where obj# = id1

27. V$locked_object: Who is locking and what?

Use this query to find out who is locking and wht

Select oracle_username, os_user_name, locked_mode, object_name.object_type from v$locked_object a, dba_objects b where a.object_id = b.object_id.

28. V$log : contains information on each log group. Common values for status column are unused, current, active, inactive.

29. V$logfile: this view can be queried to find the filenames, group numbers, and states of redo logfiles. For example to find all files of group 2 use

Select member from v$logfile wher group# = 2

30. V$log_history: This view contains an entry for each log switch that occurred. The column first_time indicates the time of the first entry

On physical standby database , this view shows applied logs.

31. V$logstdby: Can be used to verify that archived redo logs are being applied to standby databases.

32. V$managed_standby: monitors the progress of a standby database in managed recovery mode, it displays information about the activities of log transport service and log apply service.

33. V$nls_parameters: The NLS parameters that are in effect for the session quering this view. This view NLS_SESSION_PARAMETERS is based on v$nls_parameters.

34. V$object_usage: This gathers information about used indexes when an index is monitored using alter index monitoring usage.

35. V$open_cursor

36. V$option: This view lets you see which option are installed in the server.

37. V$Parameter: lists the name-value pairs of the init.ora file. For example if you want to find the db block size use the following query
Select value from v$parameter where name =’db_blokc_size.
38.
39. V$pgastat

40. V$Process: join v$process’s addr with v$session paddr

The column traceif is equal to the value used in alter session set.

41. V$pwfile_users: Lists all users who have been granted sysdba or sysoper privileges.

42. V$recover_file: useful to find out which datafiles need recovery.

43. V$recovery_file_dest:

44. V$reserved_words

45. V$resource_limit: these are the following columns resource_name, current_utilization, max_utilization, initial_allocation, limit_value.

46. V$rollname: the name of the online rollback segments. .This view’s usn filed can be joined with v$rollstats’s usn field and with v$transaction’s xidusn field

47. V$transaction can be used to tract undo by session.

48. V$rollstat: statistics for rollback segments

49. V$session: It contains all information about present session. A record in v$session contains sid and serial#. These numbers can be used kill a session (alter system kill session). Query v$session to find the necessary columns.

Some of the important columns are : SID, Serial#, user, username, lockwait,server,status,osuser,process, blocking_session, blocking_instance, event, sql_trace.

Join sid with v$sesstat if you want to get some statistical information for a particular sesssion.

50. V$sessmetric: This view is new in Oracle 10g and allows improved timing and statistics.

51. V$session_event: this view is similar to v$system_event. However, it breaks it down to currently connected sessions.

V$session_event has also the columns max_wait that shows the maximum time waited for a wait event.

52. V$session_longops: use v$session_longops if you have a long running pl/sql procedure and want to give feedback on how far the procedure proceeded. If there is any procedure which is running it will report its progress in v$session_longops. The procedure will also set the module attribute in v$session which makes it possible to find the sid, serial # of the session.

For example : If the procedure long_proc is run, you can issue the following query to get feedback on its progress:

Use the following sql statement:

Select time_remaining, sofar,elapsed_seconds from v$session_lonops l, v$session s where l.sid =s.sid and l.serial# =s.serial# and s.module =’long_proc’

53. V$session_wait: This views shows what wait event each session is waiting for, or what the last event was that it waited for.

In contrast, v$session_event lists the cumulative history of events waited for in a session. The columns P1, P2 and P3 are parameters that are dependant on the event. With Oracle 10g, v$session_wait's information will be exposed within v$session as well. Since 10g, Oracle displays the v$session_wait information also in the v$session view.

54. V$session_wait_history: This view is new in oracle 10g and allows improved timing and statistics.

55. V$sesstat: This view is similar to v$mystat except that it shows cumulated statistics for all sessions.

Join sid with v$session and join statistic# with v$statname.

V$sesstat is also similar to v$systat except that v$sysstat accumulated the statistics as soon as a session terminated.

56. V$sga: shows how much memory the shared global area uses.

Selecting * from v$sga is roughly the same as typing show sga

57. V$sgastat: shows free space in sga

58. V$sga_dynamic_components: it contains information about sga resize operation since startup. This is also used to find the granule size of SGA.

59. V$sga_resize_ops


60. V$sort_usage:


61. V$sort_segments

62. V$spparameter: Returns the values for spfile.

63. V$SQL: v$sql is same as v$sqlarea, the main difference being that v$sql drills down to select * from x$kglob whereas v$sqlarea drills down to select sum from x$kglob.

64. V$sqlarea: It tells you the sql text of currently running sql statements.

The field version_count indicated how many versions an sql statement has

Select sql_text from v$sqlarea where users_executing > 0;

65. V$sqL text,


66. V$sql_plan


67. V$sql_text_with_newlines


68. V$sql_bind_data:


69. V$sql_bind_capture: This view captures bind variables for all sessions.

70. V$sql_cursor


71. V$sqL_workarea


72. V$standby_log

73. V$statname: use this view to get the decoded names for the statistic# filed of v$sysstat , v$mystat, and sessstat

74. V$sysmetric: This view is new in oracle 10g and allows improved timing and statistics.

75. V$sysmetric_history: New in oracle 10g and allows improved timings and statistcs.

76. $sysstat: v$sysstat is similar to v$sesstat. While v$sesstat displays statitics for the current session, v$sysstat displays the cumulated statitics since startup of the database.

For example, it is possible to find out the CPU time (name = 'CPU used by this session')

This view is (among others) used to calculate the Hit Ratio.

77. v$system_event

This view displays the count (total_waits) of all wait events since startup of the instance. If timed_statistics is set to true, the sum of the wait times for all events are also displayed in the column time_waited.

The unit of time_waited is one hundreth of a second. Since 10g, an additional column (time_waited_micro) measures wait times in millionth of a second.

total_waits where event='buffer busy waits' is equal the sum of count in v$waitstat.

v$enqueue_stat can be used to break down waits on the enqueue wait event.

While this view totals all events in an instance, v$session_event breaks it down to all currently connected sessions.

78. V$undostat


79. V$tempfile


80. V$tempstat


81. V$thread


82. V$timer


83. V$transaction


84. V$trasnportable_platform

85. V$version: use this view to find out what version you actually work on

select * from v$version

86. V$waitstat


Regards,
Sowmya (OSR)
http://usdba.blogspot.com/2010/03/oracle-v-views.html

Tuesday, March 2, 2010

SQL * Plus

Hello Everyone,
Here is my post for the week


SQL * Plus

SQL * Plus is a command-line interface and which is a most familiar face of the oracle database. It’s a client –server application which allows you to execute SQL statements and PL/SQL blocks. One of the most common use of SQL * plus is as an ad hoc query tool. It is used for database administration and operation functions, including creating database objects and structures, managing oracle user id’s and object security, starting up and shutting down database instances and so on. You can also type different sql statements, execute it and see what result comes back from the database.

Different ways of invoking SQL *Plus

Starting SQL * Plus:

1. Make sure that SQL * Plus is installed on your computer

2. /log on to the host operating system

3. Enter command, SQL Plus and press Return

SQL * plus displays version number, the current date, copyright information and prompts you for the authentication (username and password)

4. Enter user and password and press return.

The process of entering the username and password is called logging in.

5. Next it displays the SQL *Plus command prompt

SQL>

Starting SQL *Plus using password on OS Platform.

Well most of us starts SQL * Plus with a password on UNIX and Linux platforms without considering the security threats.

For example

$ Sqlplus ml/ml@testdb

Here the password entered on the command prompt is easily available to all the operating system users on the host machine to view and hack the password which is not a recommended method.

The intruders can easily hack the password by using

$ps –ef
grep Sqlplus

oracle 14490 2190 0 16:31:53 pts/5 0:00 sqlplus ml/ml@testdb

oracle 14493 14491 0 16:32:01 pts/5 0:00 grep Sqlplus

Best way of invoking Sqlplus without using the password is

$ Sqlplus ml@testdb

Enter Password: **

If you want to make it more safe you can also invoke Sqlplus using

$ Sqlplus

Enter username : ML@testdb

Enter Password : **

Or

$ Sqlplus /nolog

SQL > connect ml/ml@testdb

Or

$ Sqlplus /nolog

SQL> connect ml@testdb

Enter password: **

Note: All this depends on the OS make sure that you use a secure OS. In late 9i and in 10g the executable code became secure.

will appreciate your comments.
Regards,
Sowmya(OSR)