Monday, January 31, 2011

What are the File/Directory Permissions in Unix/Linux?

Every user on a Unix/Linux system has a unique username, and is a member of at least one group. This group information is held in the password file stored in /etc/passwd. A user can also be a member of one or more other groups, stored in /etc/group.  Only the administrator can create new groups or add/delete group members.


Every directory and file on the system has an owner, and also an associated group. It also has a set of permission flags which specify separate read, write and execute permissions for the owner, group and other.

ls -l command shows the permissions and group associated with files.
ls -g command shows the group information.

The permission flags are read as follows (left to right)
1
directory flag, 'd' if a directory, '-' if a normal file, something else occasionally may appear here for special devices.
2,3,4
read, write, execute permission for User (Owner) of file
5,6,7
read, write, execute permission for Group
8,9,10
read, write, execute permission for Other

-
in any position means that flag is not set
r
file is readable by owner, group or other
w
file is writeable. On a directory, write access means you can add or delete files
x
file is executable - only for programs and shell scripts.
Execute permission on a directory means you can list the files in that directory

Sunday, January 23, 2011

Please explain - rollforward & rollback.


  • Rollforward refers to the process Oracle goes through to apply changes contained in the redo log files (both online and archive). The database SCN is moved forward within the blocks of the datafile that are changed within the redo log vectors. Roll forward occurs during database tablespace or datafile recovery and during crash recovery.
  • Rollback is the process of undoing uncommitted database transactions. The blocks copied to the rollback segments during transactions as a copy of the block for other transaction to read.When the instance aborts the undo information in the redo log files must be applied to the database during the roll forward process of recovery. Therefore during recovery the database must roll forward and roll back.
  •  Roll forward is applied on Redo log files as Rollback is applied on undo log files.

Explain the Perfomance Tuning.


  • It is the Improved throughput in OLTP System or decrease response time in datawarehouse(DWH). It s like that how fast we get output of a query/transaction/page/form from one to another.
  • Tuning can be applied at
    Query level /Object level / Database level /Application level / System level
  • Tuning is mainly responsible for   
    Database designer, Database developer, Database administrator(DBA), Application developer, etc.

How to send email from 10g Oracle Database (UTL_MAIL)?

To enable mailing from database using below steps.
1. sqlplus ‘/ as sysdba’
2. @$ORACLE_HOME/rdbms/admin/utlmail.sql
3. @$ORACLE_HOME/rdbms/admin/prvtmail.plb
4. Set smtp_server information in init.ora or spfile.ora

alter system set smtp_out_server = ‘SMTP_SERVER_IP_ADDRESS:SMTP_PORT’ scope=both;

Use default SMTP Port as 25.
If database instance had been started with spfile

alter system set smtp_out_server = ’10.10.10.10:25′ scope=both;

If database instance had been started with pfile


alter system set smtp_out_server = ’10.10.10.10:25′;


Also make below entry in your initSID.ora 
smtp_out_server = ’10.10.10.10:25′

To enable other DB users to use this functionality, grant execute permission on UTL_MAIL package.

grant execute on utl_mail to USERS;

Now,database configuration finished.
To send email, use below code in your procedure/package,

exec utl_mail.send((sender => ‘abc@abc.com’, recipients => ‘xyz@xyz.com’, subject => ‘Testing UTL_MAIL Option’, message => ‘TESTMAIL USING  UTL_MAIL PACKAGE.’);
 
Check the inbox of the email id, to verify the email received or not.

How I can find a running Oracle database is started using PFILE or SPFILE?


You can check through following ways

Check in v$parameter view

Select * from v$parameter where  upper(name)  like ‘SPFILE’;                              
or
SHOW PARAMETER SPFILE. 


If you find any data in above query then it started using SPFILE else with PFILE.

Wednesday, January 19, 2011

What is Oracle Data Pump (impdp and expdp)?

  • Oracle Data Pump is a new feature of Oracle Database 10 g that provides high speed, parallel, bulk data and metadata movement of Oracle database contents.
  • DBMS_DATAPUMP package  provides a server-side infrastructure for fast data and metadata movement. expdp and impdp is used to import/export activites.
  • It vastly improved performance and greatly enhanced functionality, such as restartability, flexible object selection, and better monitoring and control of export and import jobs.
  • Data Pump is server-based, rather than client-based. Dump files, log files, and SQL files are accessed relative to server-based directory paths, so that appropriate file security can be enforced.
  • Data Pump requires you to specify directory paths as directory objects. A directory object maps a name to a directory name on the file system.
  • Before you can run Data Pump Export or Data Pump Import, a directory object must be created by a DBA or by any user with CREATE ANY DIRECTORY privilege.