://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The...

25
Basic File Navigation The "pwd" command displays the current directory: root> pwd /u01/app/oracle/product/9.2.0.1.0 The "ls" command lists all files and directories in the specified directory. If no location is defined it acts on the current directory: root> ls root> ls /u01 root> ls -al The "-a" flag lists hidden "." files. The "-l" flag lists file details. The "cd" command is used to change directories: root> cd /u01/app/oracle The "touch" command is used to create a new empty file with the default permissions: root> touch my.log The "rm" command is used to delete files and directories: root> rm my.log root> rm -R /archive The "-R" flag tells the command to recurse through subdirectories. The "mv" command is used to move or rename files and directories: root> mv [from] [to] root> mv my.log my1.log root> mv * /archive root> mv /archive/* . The "." represents the current directory The "cp" command is used to copy files and directories: root> cp [from] [to] root> cp my.log my1.log root> cp * /archive root> cp /archive/* . The "mkdir" command is used to create new directories: root> mkdir archive The "rmdir" command is used to delete directories: root> rmdir archive The "find" command can be used to find the location of specific files: root> find / -name dbmspool.sql root> find / -print | grep -i dbmspool.sql The "/" flag represents the staring directory for the search. Wildcards such as "dbms*" can be used for the filename. The "which" command can be used to find the location of an executable you are using:

Transcript of ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The...

Page 1: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Basic File Navigation

The "pwd" command displays the current directory:root> pwd/u01/app/oracle/product/9.2.0.1.0The "ls" command lists all files and directories in the specified directory. If no location is defined it acts on the current directory:root> lsroot> ls /u01root> ls -alThe "-a" flag lists hidden "." files. The "-l" flag lists file details.

The "cd" command is used to change directories:root> cd /u01/app/oracleThe "touch" command is used to create a new empty file with the default permissions:root> touch my.logThe "rm" command is used to delete files and directories:root> rm my.logroot> rm -R /archiveThe "-R" flag tells the command to recurse through subdirectories.

The "mv" command is used to move or rename files and directories:root> mv [from] [to]root> mv my.log my1.logroot> mv * /archiveroot> mv /archive/* .The "." represents the current directory

The "cp" command is used to copy files and directories:root> cp [from] [to]root> cp my.log my1.logroot> cp * /archiveroot> cp /archive/* .The "mkdir" command is used to create new directories:root> mkdir archiveThe "rmdir" command is used to delete directories:root> rmdir archiveThe "find" command can be used to find the location of specific files:root> find / -name dbmspool.sqlroot> find / -print | grep -i dbmspool.sqlThe "/" flag represents the staring directory for the search. Wildcards such as "dbms*" can be used for the filename.

The "which" command can be used to find the location of an executable you are using:oracle> which sqlplusThe "which" command searches your PATH setting for occurences of the specified executable.

File Permissions

The "umask" command can be used to read or set default file permissions for the current user:root> umask 022The umask value is subtracted from the default permissions (666) to give the final permission:

Page 2: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

666 : Default permission022 : - umask value644 : final permissionThe "chmod" command is used to alter file permissions after the file has been created:root> chmod 777 *.log

Owner Group World Permission========= ========= ========= ======================7 (u+rwx) 7 (g+rwx) 7 (o+rwx) read + write + execute6 (u+wx) 6 (g+wx) 6 (o+wx) write + execute5 (u+Rx) 5 (g+Rx) 5 (o+Rx) read + execute4 (u+r) 4 (g+r) 4 (o+r) read only2 (u+w) 2 (g+w) 2 (o+w) write only1 (u+x) 1 (g+x) 1 (o+x) execute onlyCharacter eqivalents can be used in the chmod command:root> chmod o+rwx *.logroot> chmod g+r *.logroot> chmod -Rx *.logThe "chown" command is used to reset the ownership of files after creation:root> chown -R oinstall.dba *The "-R" flag causes the command ro recurse through any subdirectories.

OS Users Management

The "useradd" command is used to add OS users:root> useradd -G oinstall -g dba -d /usr/users/my_user -m -s /bin/ksh my_user

The "-G" flag specifies the primary group. The "-g" flag specifies the secondary group. The "-d" flag specifies the default directory. The "-m" flag creates the default directory. The "-s" flag specifies the default shell.

The "usermod" command is used to modify the user settings after a user has been created:root> usermod -s /bin/csh my_userThe "userdel" command is used to delete existing users:root> userdel -r my_userThe "-r" flag removes the default directory.

The "passwd" command is used to set, or reset, the users login password:root> passwd my_userThe "who" command can be used to list all users who have OS connections:root> whoroot> who | head -5root> who | tail -5root> who | grep -i oraroot> who | wc -l

The "head -5" command restricts the output to the first 5 lines of the who command. The "tail -5" command restricts the output to the last 5 lines of the who command. The "grep -i ora" command restricts the output to lines containing "ora". The "wc -l" command returns the number of lines from "who", and hence the number of

connected users.

Page 3: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Process Management

The "ps" command lists current process information:root> psroot> ps -ef | grep -i oraSpecific processes can be killed by specifying the process id in the kill command:root> kill -9 12345

uname and hostname

The "uname" and "hostname" commands can be used to get information about the host:root> uname -aOSF1 oradb01.lynx.co.uk V5.1 2650 alpha

root> uname -a | awk '{ print $2 }'oradb01.lynx.co.uk

root> hostnameoradb01.lynx.co.uk

Error Lines in Files

You can return the error lines in a file using:root> cat alert_LIN1.log | grep -i ORA-The "grep -i ORA-" command limits the output to lines containing "ORA-". The "-i" flag makes the comparison case insensitive. A count of the error lines can be returned using the "wc" command. This normally give a word count, but the "-l" flag alteres it to give a line count:root> cat alert_LIN1.log | grep -i ORA- | wc -l

File Exists Check

The Korn shell allows you to check for the presence of a file using the "test -s" command. In the following script a backup log is renamed and moved if it is present:#!/bin/kshif test -s /backup/daily_backup.logthen DATE_SUFFIX=`date +"%y""%m""%d""%H""%M"` mv /backup/daily_backup.log /backup/archive/daily_backup$DATE_SUFFIX.logfi

Remove Old Files

The find command can be used to supply a list of files to the rm command:find /backup/logs/ -name daily_backup* -mtime +21 -exec rm -f {} ;

Remove Directories/Files:

How to Delete Nested Empty Directories in Linux?Use option -p, to delete nested directories as shown below.$ rmdir -p dir1/dir2/dir3

Page 4: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Delete Directory Which has Content (i.e Directory with Files and Sub-directories)Some times you may want to delete directory which has contents in it. You can do it with rm command as shown below.$ rm -rf DIRNAME

To Rename File/Foldersrename old new old[root@localhost Desktop]# rename kp pp kp

top - display top CPU processes

vmstat - Report virtual memory statistics

What is Swap Space in Linux?

Page 5: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics.

Parameters: -a, -b,-e,-f,-g,-i,-m,-n,-o,-p,-r,-s,-t,-v,h

iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.

Page 6: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Remove DOS CR/LFs (^M)

Remove DOS style CR/LF characters (^M) from UNIX files using:sed -e 's/^M$//' filename > tempfileThe newly created tempfile should have the ^M character removed.

Run Commands As Oracle User From Root

The following scripts shows how a number of commands can be run as the "oracle" user the "root" user: #!/bin/kshsu - oracle <<EOFORACLE_SID=LIN1; export ORACLE_SIDrman catalog=rman/rman@w2k1 target=/ cmdfile=my_cmdfile log=my_logfile append EOFThis is often necessary where CRON jobs are run from the root user rather than the oracle user.

Compress Files

In order to save space on the filesystem you may wish to compress files such as archived redo logs. This can be using either the gzip or the compress commands. The gzip command results in a compressed copy of the original file with a ".gz" extension. The gunzip command reverses this process:gzip myfilegunzip myfile.gzThe compress command results in a compressed copy of the original file with a ".Z" extension. The uncompress command reverses this process:compress myfileuncompress myfile

General Performance

Page 7: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

vmstat

$ vmstat 5 3Displays system statistics (5 seconds apart; 3 times):procs memory page disk faults cpur b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id0 0 0 28872 8792 8 5 172 142 210 0 24 3 11 17 2 289 1081 201 14 6 800 0 0 102920 1936 1 95 193 6 302 1264 235 12 1 0 3 240 459 211 0 2 970 0 0 102800 1960 0 0 0 0 0 464 0 0 0 0 0 107 146 29 0 0 100

Having any processes in the b or w columns is a sign of a problem system.Having an id of 0 is a sign that the cpu is overburdoned.Having high values in pi and po show excessive paging.

procs (Reports the number of processes in each of the following states) o r : in run queueo b : blocked for resources (I/O, paging etc.)o w : runnable but swapped

memory (Reports on usage of virtual and real memory) o swap : swap space currently available (Kbytes)o free : size of free list (Kbytes)

page (Reports information about page faults and paging activity (units per second) o re : page reclaimso mf : minor faultso pi : Kbytes paged ino po : Kbytes paged outo fr : Kbytes freed o de : anticipated short-term memory shortfall (Kbytes)o sr : pages scanned by clock algorith

disk (Reports the number of disk operations per second for up to 4 disks faults (Reports the trap/interupt rates (per second)

o in : (non clock) device interuptso si : system callso cs : CPU context switches

cpu (Reports the breakdown of percentage usage of CPU time (averaged across all CPUs)

o us : user timeo si : system timeo cs : idle time

CPU Usage

sar

$ sar -u 10 8Reports CPU Utilization (10 seconds apart; 8 times):Time %usr %sys %wio %idle11:57:31 72 28 0 011:57:41 70 30 0 011:57:51 70 30 0 011:58:01 68 32 0 011:58:11 67 33 0 0

Page 8: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

11:58:21 65 28 0 711:58:31 73 27 0 011:58:41 69 31 0 0Average 69 30 0 1

%usr: Percent of CPU in user mode%sys: Percent of CPU in system mode%wio: Percent of CPU running idle with a process waiting for block I/O%idle: Percent of CPU that is idle

mpstat

$ mpstat 10 2Reports per-processor statistics on Sun Solaris (10 seconds apart; 8 times):CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl

0 6 8 0 438 237 246 85 0 0 21 8542 23 9 9 590 0 29 0 744 544 494 206 0 0 95 110911 65 29 6 0

ps

$ ps -e -o pcpu -o pid -o user -o args | sort -k 1 | tail -21rDisplays the top 20 CPU users on the system.%CPU PID USER COMMAND

78.1 4789 oracle ora_dbwr_DDDS28.5 4793 oracle ora_lgwr_DDDS22.4 6206 oracle oracleDDDS2 (LOCAL=NO)0.1 4797 oracle ora_smon_DDDS20.1 6207 oracle oracleDDDS2 (LOCAL=NO)etc. etc. etc. etc.

The PID column can then be matched with the SPID column on the V$PROCESS view to provide more information on the process:SELECT a.username, a.osuser, a.program, spid, sid, a.serial#FROM v$session a, v$process bWHERE a.paddr = b.addrAND spid = '&pid';

Automatic Startup Scripts on Linux

Create a file in the /etc/init.d/ directory, in this case the file is called myservice, containing the commands you wish to run at startup and/or shutdown.

Use the chmod command to set the privileges to 750:chmod 750 /etc/init.d/myservice

Page 9: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Link the file into the appropriate run-level script directories:ln -s /etc/init.d/myservice /etc/rc0.d/K10myserviceln -s /etc/init.d/myservice /etc/rc3.d/S99myserviceAssociate the myservice service with the appropriate run levels:chkconfig --level 345 dbora onThe script should now be automatically run at startup and shutdown (with "start" or "stop" as a commandline parameter) like other service initialization scripts.

CRON

There are two methods of editing the crontab file. First you can use the "crontab -l > filename" option to list the contents and pipe this to a file. Once you've editied the file you can then apply it using the "crontab filename":

Login as root crontab -l > newcron Edit newcron file. crontab newcron

Alternatively you can use the "crontab -e" option to edit the crontab file directly.

The entries have the following elements:field allowed values----- --------------minute 0-59hour 0-23day of month 1-31month 1-12day of week 0-7 (both 0 and 7 are Sunday)user Valid OS usercommand Valid command or script.The first 5 fields can be specified using the following rules:* - All available values or "first-last".3-4 - A single range representing each possible from the start to the end of the range inclusive.1,2,5,6 - A specific list of values.1-3,5-8 - A specific list of ranges.0-23/2 - Every other value in the specified range.The following entry runs a cleanup script a 01:00 each Sunday. Any output or errors from the script are piped to /dev/null to prevent a buildup of mails to root:0 1 * * 0 /u01/app/oracle/dba/weekly_cleanup > /dev/null 2>&1

Cluster Wide CRON Jobs On Tru64 (HP Ux)

On clustered systems cron is node-specific. If you need a job to fire once per cluster, rather than once per node you need an alternative approach to the standard cron job. One approach is put forward in the HP best practices document (Using cron in a TruCluster Server Cluster), but in my opinion a more elegant solution is proposed by Jason Orendorf of HP Tru64 Unix Enterprise Team (TruCluster Clustercron).

In his solution Jason creates a file called /bin/cronrun with the following contents:#!/bin/kshset -- $(/usr/sbin/cfsmgr -F raw /)shift 12

Page 10: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

[[ "$1" = "$(/bin/hostname -s)" ]] && exit 0exit 1This script returns TRUE (0) only on the node which is the CFS serving cluster_root.

All cluster wide jobs should have a crontab entry on each node of the cluster like:5 * * * /bin/cronrun && /usr/local/bin/myjobAlthough the cron jobs fire on all nodes, the "/bin/cronrun &&" part of the entry prevents the script from running on all nodes except the current CFS serving cluster_root.

NFS Mount (Sun)

The following deamons must be running for the share to be seen by a PC: /usr/lib/nfs/nfsd -a /usr/lib/nfs/mountd /opt/SUNWpcnfs/sbin/rpc.pcnfsd

To see a list of the nfs mounted drives already present type:exportfsFirst the mount point must be shared so it can be seen by remote machines:share -F nfs -o ro /cdromNext the share can be mounted on a remote machine by root using:mkdir /cdrom#1

mount -o ro myhost:/cdrom /cdrom#1

NFS Mount (Tru64) -- HP UX

On the server machine:

If NFS is not currently setup do the following: Application Manager -> System Admin -> Configuration -> NFS Select the "Configure system as an NFS server" option. Accept all defaults.

Create mount point directory:mkdir /u04/backupAppend the following entry to the "/etc/exports" file:/u04/backupMake sure the correct permissions are granted on the directory:chmod -R 777 /u04/backupOn the client machine:

If NFS is not currently setup do the following: Application Manager -> System Admin -> Configuration -> NFS Select the "Configure system as an NFS client" option. Accept all defaults.

Create mount point directory:mkdir /backupAppend an following entry to the "/etc/fstab" file:nfs-server-name:/u04/backup /backup nfs rw,bg,intr 0 0Finally, mount the fileset:

Page 11: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

mount /backupAt this point you can start to use the mount point from your client machine. Thanks to Bryan Mills for his help with Tru64.

PC XStation Configuration

Download the CygWin setup.exe from http://www.cygwin.com.

Install, making sure to select all the X11R6 (or XFree86 in older versions) optional packages.

If you need root access add the following entry into the /etc/securettys file on each server:<client-name>:0From the command promot on the PC do the following:set PATH=PATH;c:cygwinbin;c:cygwinusrX11R6binXWin.exe :0 -query <server-name>The X environment should start in a new window.

Many Linux distributions do not start XDMCP by default. To allow XDMCP access from Cygwin edit the "/etc/X11/gdm/gdm.conf" file. Under the "[xdmcp]" section set "Enable=true".

If you are starting any X applications during the session you will need to set the DISPLAY environment variable. Remember, you are acting as an XStation, not the server itself, so this variable must be set as follows:DISPLAY=<client-name>:0.0; export DISPLAY

Useful Profile Settings

The following .profile settings rely on the default shell for the user being set to the Korn shell (/bin/ksh).

The backspace key can be configured by adding the following entry:stty erase "^H"The command line history can be accessed using the [Esc][k] by adding the following entry:set -o viAuto completion of paths using a double strike of the [Esc] key can be configured by adding the following entry:set filec

Useful Files

Here are some files that may be of use:

Path Contents

/etc/passwd User settings

/etc/group Group settings for users.

/etc/hosts Hostname lookup information.

Page 12: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

/etc/system Kernel parameters for Solaris.

/etc/sysconfigtab Kernel parameters for Tru64.

What are Kickstart Installations? Many system administrators would prefer to use an automated installation method to install Fedora or Red Hat Enterprise Linux on their machines. To answer this need, Red Hat created the kickstart installation method. Using kickstart, a system administrator can create a single file containing the answers to all the questions that would normally be asked during a typical installation. Kickstart files can be kept on a server system and read by individual computers during the installation. This installation method can support the use of a single kickstart file to install Fedora or Red Hat Enterprise Linux on multiple machines, making it ideal for network and system administrators.

How Do You Perform a Kickstart Installation? Kickstart installations can be performed using a local CD-ROM, a local hard drive, or via NFS, FTP, or HTTP. To use kickstart, you must:

1. Create a kickstart file. 2. Create a boot diskette with the kickstart file or make the kickstart file available on

the network. 3. Make the installation tree available. 4. Start the kickstart installation.

Daily Activities of a DBA at level 1 in any organization:

1. Creation of database machines2. Startup and shutdown of database machines.3. Password resets, reports generations.4. Checking logs5. Day-to-day tasks done for end users.6. Create a user using DBCA or OEM or DBAssist.7. Monitor available space in table spaces etc.8. creating tables and indexes.9. managing databases using DBCA, NETCA etc GUI tools.

Oracle Base and Home directories:These are directories creates under to make a database installation OFA (Oracle Flexible Architecture) complaint. ORACLE_BASE specifies the

Page 13: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

directory at the top of the Oracle software and administrative file structure. ORACLE_HOME specifies the directory containing the Oracle software for a given release or Oracle Binaries.

echo $ORACLE_BASEResults like: /u01/app/oracleFiles like:

Oracle -> admin folder -> orcl -> (adump, bdump, cdump, dpdump, pfile, udump) exists.Under pfile - init.ora file exists which contains all initialization parameters.

Oracle -> oradata -> orcl -> (control1, 2, 3.ctl files --- Redo01,02,03.log --- sysaux01.dbf, system01.dbf, temp01.dbf, undotbs.dbf, users01.dbf)

Oracle -> OraInventory: The Orainventory is the location for the OUI's (Oracle Universal Installer) Book keeping. The inventory stores information about. * All the Oracle software products installed on all ORACLE_HOMES on a machine * Other non-oracle products such as Java Runtime env's (JRE)

Oracle -> Flash_recovery_area: The flash recovery area is an Oracle-managed directory, file system, or Automatic Storage Management disk group that provides a centralized disk location for backup and recovery files. All the files you need to completely recover a database from a media failure are part of the Flash Recovery Area. Oracle creates archived logs and flashback logs in the flash recovery area. RMAN can store its backup sets and image copies in the flash recovery area, and it uses it when restoring files during media recovery. The flash recovery area also acts as a disk cache for tape.

echo $ORACLE_HOMEResults like: /u01/app/oracle/product/10.2.0/db_1

/u01/app/oracle/product/10.2.0/db_1contains many directories and files including listener.log, shutdown.log, sqlnet.log, startup.log,$ORACLE_HOME (/u01/app/oracle/product/10.2.0/db_1) --> network --> admin --> listener.ora, tnsnames.ora, sqlnet.ora, shrept.lst

echo $ORACLE_SIDResults like: orcl (Name of the instance)

Page 14: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

To know the status of pmon (process monitor):[root@localhost ~]# ps -ef | grep -i pmonResults: oracle 2602 1 0 00:08 ? 00:00:01 ora_pmon_orclroot 16366 16162 0 02:30 pts/1 00:00:00 grep -i pmon

select * from v$sga; (provides SGA details)Results:1 Fixed Size 1219112 2 Variable Size 96470488 3 Database Buffers 2055208964 Redo Buffers 2973696

[root@localhost ~]# dmesg | grep swap (To find swap space allocated)Results: Adding 2195448k swap on /dev/VolGroup00/LogVol01. Priority:-1 extents:1 across:2195448k

To launch Oracle Net configuration assisttant (NetCA):Path: $ORACLE_HOME/bin/netca will launch the GUI console to manage configuration settings of a database.Default port of listener is 1521, and protocol is TCP/IP.

To launch Database configuration assistant (DBCA):Path: $ORACLE_HOME/bin/dbca To launch NetMgr Console: To manage Oracle Net Manager services like service naming and listeners.Path: $ORACLE_HOME/bin/netmgr

To start-stop dbconsole (OEM or Related WEB/GUI tools):[root@localhost bin]# emctl start dbconsole

Ref: emctl - enterprise manager command line utility.

Page 15: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

What are Oracle Binaries ?A: Binaries could be any text based file which contains data for processing but in terms of Oracle binaries are files that copied and created under directory: Oracle HomeMeans: Oracle Home (Binaries)Oracle Home: /u01/app/oracle/product/10.2.0/db_1

What is a Listener and TNSNames.ora file?> A listener is running on the server side to redirect input request on a given port to the database (by default 1521). TNSNAMES.ORA is a SQL*Net configuration file that defines databases addresses for establishing connections to them. A tnsnames.ora is a configuration file on client side to link a tns entry used in the connection string to a host, service name and port (known by the listener).

Tnsnames.ora file looks like:

----------------------------------------------------------------------------------------------------------ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )

EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) /*Listening endpoints* ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )-----------------------------------------------------------------------------------------------------------

Page 16: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

References:

EXTPROC_CONNECTION_DATA: is a special service name that is used for external procedures.

Key and SIDThe two items in this entry that could be changed are the name of the key (EXTPROC1) and the SID (PLSExtProc) and is a listener service. These items are used to link this entry to corresponding information in the file listener.ora. The key can be any short name but must be the same in both the listener.ora and tnsnames.ora files. These values are case sensitive. They are only used by the listener process, not by users or applications.

Listeners:

status: > lsnrctl statusresults like:

===============================================================[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-FEB-2012 19:19:19

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))STATUS of the LISTENER--------------------------------------------------------------------------------------------------------

Alias LISTENERVersion TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date 16-FEB-2012 17:49:59Uptime 0 days 1 hr. 29 min. 20 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.logListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))Services Summary...Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...Service "orcl" has 1 instance(s).

Page 17: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

Instance "orcl", status READY, has 1 handler(s) for this service...Service "orclXDB" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service...Service "orcl_XPT" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service...The command completed successfully

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

Listener.ora file is a text file and looks like:

----------------------------------------------------------------------------------------------------------SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (PROGRAM = extproc) ) )

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) /*listening endpoints* (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) ) )----------------------------------------------------------------------------------------------------------

Sqlnet.ora file: (text file)is a text file that provides SQL*Net with basic configuration details like tracing options, default domain, encryption, etc. Resides in oracle home/network/admin folderAnd looks like:

--------------------------------------------------------------------------# sqlnet.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)-----------------------------------------------------------------------------

Page 18: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

References:NAMES.DIRECTORY_PATH Specifies the order of naming methods that are used when a client tries to connect to a database. Possible values: TNSNAMES, LDAP, ONAMES, HOSTNAME, EZCONNECT.

EZCONNECT eliminates the need for service name lookups in tnsnames.ora files when connecting to an Oracle database across a TCP/IP network. In fact, no naming or directory system is required when using this method as it provides out-of-the-box connectivity.

Net8: is Oracle's client/server middleware product that offers transparent connection from client tools to the database or from one database to another.

Pfile/SPFile (Initialization File – Init.ora):Startup file which contains initialization parameters for an instance to start.(SPFILEs are available in Oracle 9i and above. All prior releases of Oracle are using PFILEs.) There are two kinds of initialization parameters:Dynamic initialization parameters can be changed for the current Oracle Database instance. The changes take effect immediately.

Static initialization parameters cannot be changed for the current instance. You must change these parameters in the text initialization file or server parameter file and then restart the database before changes take effect.

Page 19: ://oracleant.files.wordpress.com/2012/05/unix-oracle …  · Web viewroot> chmod -Rx *.log. The "chown" command is used to reset the ownership of files after creation: root> chown

SQL> SHOW PARAMETERS: This SQL*Plus command displays the values of initialization parameters in effect for the current session.Difference between p file and sp file?Pfile is a text files resides under oracle_base->orcl->admin folder along with bdump, cdump etc files saved in the form of ‘init.ora’ file in pfile directory. Can be edited using any standard editors like nano, vi, vim etc.SPFile on the other hand non editable, means cannot be edited using the text editors else have to use command ALTER SYSTEM. Provides more flexibility and helps to make dynamic changes to parameters. It can also backed up by using RMAN.

Oracle Architecture:

Includes Physical + Logical and background process = Instance.