Monday, July 6, 2009

Oracle Simple DBA Tasks

I recently started working heavily on Oracle database DBA stuff, export, import convert to arabic characterset ..etc.

So this blog will list all information regarding these tasks and how to accomplish inorder to be reference in any future similar dba tasks.

First of all whenver you try to make any dba you have to connect as sysdba user privilages for example

Open SQLPlus, and login as sys/sys as ssydba

- Export database

exp userid=dbuser/dbuserpassword file=c:\anyfile.dmp

- Import dump

If you need to import this dump file into another user you have to do the following:

1- If user not created, create new user

create user user_name identified by password

2- grant him dba privilages.

grant dba to user_name;

3- Import database:

imp file=c:\anyfile.dmp fromuser=dbuser touser=user_name userid=dbuser/dbuserpassword

Also if this user needed to be removed run the following:

DROP USER ahmaddb CASCADE;


Another needed task was converting the characterset to be arabic enabled.

1- First full backup should be taken from database.
2- You should shutdown database and make restricted session as follows:


SHUTDOWN IMMEDIATE;
STARTUP MOUNT;

ALTER SYSTEM ENABLE RESTRICTED SESSION;

ALTER DATABASE CHARACTER SET AR8MSWIN1256;

and by these steps your database engine will be arabic enabled.

One note is that when arabic is needed to be enabled on client machines having oracle client only, you should just change regsitry value on NLS_LANG as follows:

go to:

HKEY_LOCAL_MACHINE-->SOFTWARE-->ORACLE_HOME

Open NLS_LANG parameter and put AR8MSWIN1256 value instead of current one and this should be same as server value.