Total Pageviews

Oracleadm


SQLPLUS shortcuts:

/ -will execute the last run statement in the sqlplus buffer
1 -will display the last run statement in the sqlplus buffer
change /old/new -Changes the first occurrence of the text on the current line in the sqlplus buffer.


 ---------------------------------------------------------------------------------------------------
Oracle EZCONNECT:

sqlplus user/pwd@//192.168.1.20:1521/ORCL


With this we can connect to a database without TNSNAMES configuration.
---------------------------------------------------------------------------------------------------
Oracle Analyze a table:

alter table table_name estimate statistics;

Analyze a schema:

login as sys user

begin
exec dbms_stats.gather_schema_stats("SCOTT");
end;
---------------------------------------------------------------------------------------------------
HP UX commands:

machinfo - to find the machine information
swapinfo - to find the swap partition size
bdf - to check the partition information (in kbytes)
---------------------------------------------------------------------------------------------------
Configuring SAMBA server in RHEL5.5.

-give full permission on the sharable directory( chmod 777 /pack/sample
-samba package should be installed or do yum install samba if you have yum repository
-$vi /etc/samba/smb.conf
-add the following lines in the file mentioned to share the mentioned directory
- [Share]
   path = /home/share
   writable = yes
   guest ok = yes
   guest only = yes
   create mode = 0777
   directory mode = 0777
   share modes = yes

use testparm command to check and verify the samba configuration file.
---------------------------------------------------------------------------------------------------
ORATAB file is created during oracle installation. This file resides in /etc directory or in /var/opt/oracle directory.
This file is used to list the databases installed and the oracle versions. Oratab file contains ORACLE_SID, ORACLE_HOME, and automatic startup , shutdown of database with OS startup and shutdown. The environment variables in OS level are taken from this file.
For example:

college:/oracle/app/product/11.2.0/db_home1:Y

The Y in the above line mentions to autostart the db and listener while OS startup. This oratab file works for only  one instance and you cannot add multiple instances of database into this file.

-------------------------------------------------------------------------------------------------------------

Oracle DB link


Creating dblink from oracle 10g database to a user in oracle 11g database :

create database link link_name connect to "username" identified by "password" using 'connection_string';

The username and password should be given within double quotes.

There are other conditions too for a dblink, that is

  Both the database servers should be in same domain

  The user should have 'CREATE DATABASE LINK' privilege

-------------------------------------------------------------------------------------------------------------

Oracle - Create Tablespace


SQL> create tablespace tbs_name datafile '/vol01/oradata/sample/datafile/exp101.dbf' size 100M autoextend on next 2M maxsize unlimited extent management local segment space management auto;
 
Force Drop a tablespace:
------------------------------
SQL> alter tablespace tbs_name offline drop;

Ensure no active connections writing on that particular table.

Change DB name:
-----------------------

nid is the utility to change the dbname.

The database should be in the mounted exclusive state,

nid TARGET=sys/password@tnsname
Compile Oracle Schema using sqlplus
---------------------------------------

execute dbms_utility.compile_schema('SCOTT');

as a 'SYS' user.

Managing Rouge sessions in Oracle:
------------------------------------------------

1. Identify the session to be killed


SELECT a.inst_id,
       a.sid,
       a.serial#,
       b.spid,
       a.username,
       a.program
FROM   gv$session a
       JOIN gv$process b ON b.addr = a.paddr AND b.inst_id = a.inst_id
WHERE  a.type not like  'BACKGROUND';

2. Alter system kill session 'sid,serial#';

This command will kill the session. Run as sys user. If still the session persists you can use "immediate" clause with the above command. like

Alter system kill session 'sid,serial#' immediate;

If its a RAC instance then

Alter system kill session 'sid,serial#,@inst_id' immediate;\

3. The other way is Disconnect Session

This option does not kill the session but it will disconnect the session and make the dedicated server process(dedicated server mode)  in os level to shut for that particular session.

Alter  system disconnect session 'sid,serial#' post_transaction;
the post_transaction option will wait for the current transaction to complete.

Alter system disconnect session 'sid,serial#'  immediate;
The immediate option will stop the current transaction too. (recommended)

4. Killing in OS level

If you want to kill a OS level oracle process(server process) responsible for the session then issue

orakill ORACLE_SID spid;

from command prompt for windows.

kill -9 spid

for unix flavours.(the spid for the session can be acquired from the v$process, refer the query in point 1)

Oracle archive_lag_target

The archive_lag_target parameter is very useful for DataGuard setup, since this parameter will switch the logfile in the specified time interval. By default the parameter is 0 sec. The unit for this parameter is in seconds.

Responsibilities of an ORACLE dba

    As I am a DBA for more than a year I have came to know lot of things happening in the industry. I would like to share all those with you. A DBA is solely responsible for the database, so ensure before firing any commands. When you are working with OLTP environment, you have to be more cautious. You have to know all the features and differences between oracle versions.version info. He should be able to work on any OS platforms, also should have some idea about hardware setup, memory management like RAID, san storage etc. You all may think that a DBA should do only backup, recovery, monitoring operations. But other than this there are lot of roles a DBA has. It differs based on the industry and institutions you work.oracle.


Installing, upgrading, and patching Oracle Database software

Designing databases based on requirements

Creating Oracle databases

Testing backup and recovery strategy, and prepare a plan for failure cases.

Backup data regularly

Making connectivity for clients to connect the database across network.

Startup and shutdown the database

Managing tablespaces and datafiles

Managing users and security

Managing database objects

tuning database for performance

Proper usage of Oracle corp support while needy

Evaluating and testing new database features

Oracle Database Control file

Control files has the status of the physical structure of a database.  A control file should be backup whenever a change is made to the database.The controlfile contains the following sections:
  • ARCHIVED LOG (reusable)
  • BACKUP SET (reusable)
  • BACKUP DATAFILE (reusable)
  • BACKUP CORRUPTION (reusable)
  • BACKUP PIECE (reusable)
  • BACKUP REDOLOG (reusable)
  • BACKUP SET (reusable)
  • BACKUP SPFILE
  • CKPT PROGRESS
  • COPY CORRUPTION (reusable)
  • DATABASE
  • DATAFILE
  • DATAFILE COPY (reusable)
  • DATAFILE HISTORY
  • DATABASE INCARNATION
  • DELETED OBJECT (reusable)
  • FILENAME
  • FLASHBACK LOG
  • INSTANCE SPACE RESERVATION
  • LOG HISTORY (reusable)
  • MTTR
  • OFFLINE RANGE (reusable)
  • RECOVERY DESTINATION
  • REMOVABLE RECOVERY FILES
  • RMAN STATUS
  • RMAN CONFIGURATION
  • REDO THREAD
  • PROXY COPY 
  • TABLESPACE
  • TEMPORARY FILENAME
  • THREAD INSTANCE NAME MAPPING
To view control file status
SQL> show parameter control_files

To backup control file before any operation:
SQL> alter database backup controlfile to 'c:\ora\control01.ctl'

Multiplexing of control files:
Can be done by giving the following line in pfile: control_files='E:\app\oradata\revolt\control01.ctl','E:\app\oradata\revolt\control02.ctl'

Recovery of database without controlfile and redolog
alter database backup controlfile to trace resetlogs 



Importance of Parameter File or PFILE:

    During an oracle instance startup, the characteristic features of the instance are configured by the parameters written in a PFILE or Initialization parameter file or Static Parameter file. The PFILE is commonly known as init.ora file among the DBA community. The naming convention for PFILE is initSID.ora and placed in the $ORACLE_HOME/dbs folder in default. PFILE is a txt file and can be edited using an operating system editor like notepad. PFILE is opened only during instance startup. There is an other similar file in oracle server named as SPFILE or Persistent parameter file. SPFILE is a binary file which cannot be opened manually. SPFILE concept is available only from oracle 9i and above versions. For detailed information regarding the parameter files please visit initSID.ora

Example of a PFILE:

      # Initialization Parameter File : inituser.ora
      db_name = user
      instance_name= user
      control_files = (home/user/ORADATA/u01/controluser.ctl)
      db_block_size = 4096
      db_cache_size=4M
      shared_pool_size = 50000000
      java_pool_size =50000000
      max_dump_file_size = 10240
      background_dump_dest = /home/user/ADMIN/BDUMP
      user_dump_dest = /home/user/ADMIN/UDUMP
      core_dump_dest = /home/user/ADMIN/CDUMP
      undo_management = AUTO
      undo_tablespace = UNDOTBS
  

ORACLE ARCHITECTURE

Oracle database server architecture
Oracle Utilities
RMAN
SQL Loader
Export
Import

Linux Commands

       Linux commands can be  used configure and interact with Linux OS. The linux commands can be used at the shell prompt, or command prompt (Terminal). If you are using  linux in a GUI, try with the shell programming icon. If you do not have GUI then  you should be working with the shell prompt, and if you are signing through remote then you will be at the prompt. The two types of commands are shell commands and linux commands.

Linux Commands:

The Linux commands are not  shell commands. Each linux command is a individual executable program, thats written in  C-programming language. These executable programmes are stored in various physical directories such as /bin.The $PATH variable defines  the location of the directories. These linux commands differ from the linux distrubutions, and remains similar in any shell they are being used.

 Shell Commands:

The shell program consists of the shell commands. There are different kind of shells likely  bash shell, C shell, bourne shell etc. Each shells have variance in them. The commands structure vary between shells, but each shell is same among different linux platforms.

 The Command Prompt:

The prompts look is depend on the shell you use, and the settings you have for that shell.
The bash shell have the prompt set up like the following

[adm@cric home]#

Here the user logged is adm, and the computer name is  cric where the folder is home. The password file(pwd) is to be used to get full path.


Your prompt is bound to look different, so for the purpose of this section I will just use the > to represent the prompt.
>

Linux Commands:

Some linux commands are very simple and need nothing more than the command itself.
For example the command ls (list) will simply list the names of the directories and files in the current directory...
>ls
files/
images/
index.txt
>
In this instance ls shows there are two directories, called files and images, and a text file called index.
However you can often add options or parameters, which are usually added to the command after a '-'.
Adding the option -l will give you a long listing which includes the permissions, ownership, size, date/time, and name of the files and directories...
>ls -l
drwx------ 2 bob bob 4096 Aug 22 10:31 files/
drwx------ 3 bob bob 4096 Mar 19 11:17 images/
-rwx------ 1 bob bob 284 Mar 18 10:23 index.txt
>
Another example would be adding -a (ls -a) to list ALL the files in the current directory, including hidden files.
>ls -a
.hiddenfile
files/
images/
index.txt
>
This shows there is a hidden file (hidden files have a '.' before the filename) called '.hiddenfile', as well as the two directories and index file.
You can use more that one option at a time...
>ls -la would produce a long listing format of ALL (including hidden) directories and files in the current working directory.
There are many options for some linux commands, and the best place to find out about then all is the 'man' pages. These man pages show you how to format the command, and what options and parameters there are to use with each command.

 Few Basic commands

#free  -shows free RAM space
#date -current date
#time -shows system time
#cp
-to copy a file or directory#mkdir dir1   -to create directory
#rmdir dir1    -to remove a directory


Locate command is works only on linux kernel. It displays the absolute path for the search term.locate reads from the database created by the updatedb command. Locate does not check the existance of the file. Here is the usage for the locate command.

$ locate -h
Usage: locate [OPTION]... [PATTERN]...
Search for entries in a mlocate database.

  -b, --basename         match only the base name of path names
  -c, --count            only print number of found entries
  -d, --database DBPATH  use DBPATH instead of default database (which is
                         /var/lib/mlocate/mlocate.db)
  -e, --existing         only print entries for currently existing files
  -L, --follow           follow trailing symbolic links when checking file
                         existence (default)
  -h, --help             print this help
  -i, --ignore-case      ignore case distinctions when matching patterns
  -l, --limit, -n LIMIT  limit output (or counting) to LIMIT entries
  -m, --mmap             ignored, for backward compatibility
  -P, --nofollow, -H     don't follow trailing symbolic links when checking file
                         existence
  -0, --null             separate entries with NUL on output
  -S, --statistics       don't search for entries, print statistics about each
                         used database
  -q, --quiet            report no error messages about reading databases
  -r, --regexp REGEXP    search for basic regexp REGEXP instead of patterns
      --regex            patterns are extended regexps
  -s, --stdio            ignored, for backward compatibility
  -V, --version          print version information
  -w, --wholename        match whole path name (default)

updatedb - can be run only as root. This updates or creates a database for locate utility.

# updatedb -h
Usage: updatedb [OPTION]...
Update a mlocate database.

  -f, --add-prunefs FS           omit also FS
  -e, --add-prunepaths PATHS     omit also PATHS
  -U, --database-root PATH       the subtree to store in database (default "/")
  -h, --help                     print this help
  -o, --output FILE              database to update (default
                                 `/var/lib/mlocate/mlocate.db')
      --prunefs FS               filesystems to omit from database
      --prunepaths PATHS         paths to omit from database
  -l, --require-visibility FLAG  check visibility before reporting files
                                 (default "true")
  -v, --verbose                  print paths of files as they are found
  -V, --version                  print version information

The lists of paths and filesystems to omit default to values read from
`/etc/updatedb.conf'.

The Oracle 11g Database Administrator

           The Oracle Database 11g is designed for administrators to provide an effective curriculum syllabus. You people learn and get knowledge to configure, install and maintenance of the database. When you learn the essentials of administrating the oracle database, you can develop knowledge in any of the following key focus areas of oracle database. They are

  1. Performance Management
  2. Manageability
  3. Linux Administration
  4. Security management
  5. High Availability
  6. Data Warehousing
  7. Grid maintenance
  8. Storage Server maintenance
The Oracle University curriculum is framed in the way to meet the DBA's challenges faced today.

Oracle indexes tuning

Indexes in Oracle database.

The indexes are

  • B-Tree indexes or balanced tree indexes;
  • bitmap indexes
  • partitioned indexes
  • domain indexes
  • function-based indexes

The B-Tree Indexes
  
          B-Tree Indexes are the most convenient thing when querying for a small amount of data from a large table. Indexes help out the most in reducing the i/o in this case.The bigger the table and lower the number of rows that you want to get them, then the more effective way is the index.
         
          Even if you see a book it has an index, this shows the importance of index. Even a book needs a index then think of the case of a terabyte oracle database. The reasons are a lot. When searching an article it would take huge time to find the particular area of interest but without using the index then it would to read the whole book. It's similar when you're querying against a database. so by working on the index, the database would have to read more data.
         
          The indexes improves read and update operations using sub-queries. However when updates are performed often in a table with index then every time the index has to get updated regarding the change in the oracle database. Sincethe amount of i/o is drastically increased causing burden to the DB server. So having indexes for read only table is recommended by oracle.The oracle dba should ensure the usage of the index. Otherwise its going to be a performance degrading for the oracle database.

Oracle Interview FAQ's.

  1. Explain about Oracle Catalog and  Archive log? 
           The Oracle  catalog contains tables and views which allows the oracle user to obtain the information about  database, such as what other tables and views are available, data dictionary views their attributes, constraints, etc. Oracle has hundreds of  system catalog relations, only some of which are available to the limited user.
  

     2. Give some of the  views in RMAN catalog which contains the catalog information?

           RC_DATABASE_INCARNATION
           RC_BACKUP-DATAFILE_SUMMARY
           RC_BACKUP_CORRUPTION 
           RC_BACKUP_COPY_DETAILS


3. How to find alert log file location?
   
SQL> show parameter background

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_core_dump                 string      partial
background_dump_dest                 string      c:\app\user\diag\rdbms\rev\rev\trace








Oracle RMAN

RMAN is a recovery management utility of oracle database. RMAN is recommended by oracle for backup and recovery. It makes the job easier for a DBA and gives flexibility to work on the database. RMAN optimizes the performance and space occupied while backup with file multiplexing and backup set compression.




Syntax for RMAN Command-line
RMAN 
[ TARGET connectStringSpec 
| { CATALOG connectStringSpec } 
| LOG ['] filename ['] [ APPEND ]
.
. 
]..
1.First create a tablespace for RMAN
 
CREATE TABLESPACE "RMAN" DATAFILE 'E:\app\solomon\oradata\revolt\rman.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 2M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCALSEGMENT SPACE MANAGEMENT AUTO;
 
2.Create a user for rman CREATE USER rman IDENTIFIED BY rmanDEFAULT TABLESPACE rman QUOTA UNLIMITED ON rman;3. Grant privileges for the user GRANT connect, resource, recovery_catalog_owner TO rman;
4. Assign catalog
C:\>rman catalog=rman/rman

RMAN> create catalog tablespace "RMAN";
RMAN> register database;

Oracle Version Releases

Oracle Database released till now

  • Oracle 5 Database
  • Oracle 6 Database
  • Oracle 7: 7.0.16—7.3.4 Database
  • Oracle 8 Database: 8.0.3—8.0.6
  • Oracle 8i Database Release 1: 8.1.5.0—8.1.5.1
  • Oracle 8i Database Release 2: 8.1.6.0—8.1.6.3Oracle8i Database Release 3: 8.1.7.0—8.1.7.4
  • Oracle 9i Database Release 1: 9.0.1.0—9.0.1.5 (patchset as of December 2003[update])
  • Oracle 9i Database Release 2: 9.2.0.1—9.2.0.8 (patchset as of April 2007[update])
  • Oracle Database 10g Release 1: 10.1.0.2—10.1.0.5 (patchset as of February 2006[update])
  • Oracle Database 10g Release 2: 10.2.0.1—10.2.0.4 (patchset as of April 2008[update])
  • Oracle Database 11g Release 1: 11.1.0.6—11.1.0.7 (patchset as of September 2008[update])
  • Oracle Database 11g Release 2: 11.2.0.1 (released 2009-09-01)
  • Oracle Database 11g Release 2: 11.2.0.3 (by 2011)
The Latest release of Oracle is 12c the cloud control for DB console(Enterprise Manager)

Oracle 11g Overview

oracle 11g
   Oracle 11g Database is highly flexible database. The 11g is upgraded from the previous versions, by configuring the hardwares and softwares related to provide good efficiency, and employ high security in the system. The automation of the backup and recovery process, provides transparent failover capability.The auditing and performance tuning  circulates your enterprise databases with Oracle Net.

  Here are some of the features of Oracle 11g discussed here.
  • To Plan and deploy the permanent, temporary, and huge tablespaces.
  • Optimizing the disk allocation, Memory usage, and SQL queries.
  • Able to develop a powerful database management system.
  • Oracle Flashback prevents against human errors.
  • Oracle Automatic Undo Management.
  • Oracle Automatic Workload Repository and SQL Tuning are used to Diagnose and tune system performance.
  • Implementing robust security by using authorization, authentication, fine-grained auditing, and  access control
  • Maintaining high availability by using Oracle(RAC) Real Application Clusters and Oracle Active Data Guard.
  • Responding more efficiently to failure circumstances by using the Oracle Automatic Diagnostic Repository and the Oracle Repair Advisor.
  • Back up and restoring tables, tablespaces, and databases with Oracle (RMAN)Recovery Manager  and Oracle Data Pump Utilities Export and Import
  • Working with network databases, data warehouses, and VLDBs

System issues towards Oracle Database

System Issues that are responsible for a crash or downfall of a Oracle DB. Here we are going to discuss how to overcome the system issues and make the database up and running at every time.

  • Periodic backups should be taken based on the working environment.
  • Check the alert logs, startup logs , shutdown logs are proper.
  • Ensure the disk spaces for the backups and alert logs are enough.
  • Go with operation tuning and limit OS level issues regarding Oracle database.
  • Do updates for system software for system issues as it may happen often.

What should one inherit to become an Oracle DBA?

" Are you sure of working about four hours continuously?" this is the case happens if a database crashes. The time for recovery makes tremendous. The Oracle DBA's are concerned only when there is emergency, so being a responsible person is proud and also a curse. You will surely feel the need for you as a Oracle DBA in the company. Its one of the high profile jobs in the software industry. You may get phone calls at mid night because some databases require to be 24/7.  All the need is time constraint to work for longer hours. Its really a challenging role. So enjoy being a Oracle DBA and serve your clients.

Oracle 9i Architecture

oracle dba

Oracle 9i - My Experience

Oracle 9i Database is the most powerful edition of oracle corporation. It has been used for OLTP environment as well as in Warehousing. Data security is very high when compared to other Databases. Now the war has been over with MySQL, because owned Sun micro systems. The i in oracle 9i denotes "internet". When oracle combines with linux it gives more reliability and security to the database system. RMAN is a tool in oracle which is very much useful for data backup and recovery.The DDL event security secures the database from structural or Data Definition Language changes made.

Does SEO make a site/blog popular?

SEO is a vast field thats growing nowadays. The SEO is mainly focussed to promote the sites in offline and online. This is a kind of Technical marketting . Inorder to do you have to perceive the industry knowledge in which industry you are going to promote your site. SEO is based on lots of constrains like backlinks, referals and daily average visits. All these things are done to get indexed in google search list. But Google often changes its criterias and no one can expect their rank or predict googles algorithm. But by being loyal and making genuine post its possible to achieve unique visitors to your site or blog.

Oracle Jobs In Chennai

There are lots of openings rushing up for IT professionals as well this year is concerned. So I would like to share   my views with you guys to get a DBA job. The areas where you have to concentrate more  are RMAN, Oracle utilities like import/export, backup and restore. The DBA profile is so interesting and challenging one for a person with desire towards DB. There are lots of databases like DB2, sybase, MySQL. Everything needs a DBA to manage it.
hits count
Database | Oracle PartnerNetwork Blog