Monday, May 2, 2011

Db question set with answers Part 2

Steps to create Database Manually?
1. set ORACLE_SID=<sid> windows
export ORACLE_SID=<sid> UNIX
2. additionally create service in windows
oradim -new -sid <sid> -srvc OracleServicesid -startmode auto/mannual -srvcstart system -pfile <spfile path> -syspwd <password for / as sysdba>
for windows
edit oratab file in /var/opt/oracle with
<DBNAME>:<home directory>:Y/N
this file is read by dbstart
for solaris
to make startmode auto give Y at the end
to make srvcstart system attach the dbstart with rc<n>.d
3. Create parameter file
4. sqlplus / as sysdba
startup nomount
run create database command
5. create additional tablespace
6. create data dictionary views and some additional scripts
7. convert pfile to spfile
8. shutdown and startup
Steps to upgrade Mannually from 9i  to 10g
1. copy parameter,password file to new 10g home location
2. run utlu101i.sql by spooling it to a file
3. do the respective changes according to spool file
change the parameter compatibility to 10.0
keep minimum sizes to memory parameters
shared_pool_size 96MB etc
4. shutdown immediate
5. change the size of redo if less then 4M
increase the size of system file where data dictionaries stored
create sysaux tablespace
6.Point env variables to new location of 10g
ORACLE_HOME
NLS_LANG
LD_LIBRARY_PATH
ORACLE_BASE etc
7.startup upgrade
run u0900010.sql if it is 9.0.1
8. run utlu101s.sql
9.recompile utlrp.sql
10. shutdown immediate and startup
Steps to apply patch using opatch
1. shutdown all the instances
2. shutdown all the services such as listener and isqlplus and dbconsole etc
3. take backup of oracle home binaries and DBs
4. opatch napply <patch_location>
or opatch apply <patchid>
Steps to clone the Database
1. create environment variables on new system
2. Copy all the files expect controlfile and redo log file to new system
3. change init file parameters as per new systems settings
4. Create controlfile to trace and modify the locations as per new system
5. on new system export oracle_sid
6. sqlplus nomount
7. run modified controlfile of trace on new system
8. recover database until given time
9. alter database open resetlogs
Steps to duplicate db using RMAN on same Server
1. create a passwordfile for duplicate database named as DUP
2. create listener and tns entry for Database DUP
3. copy init file of target and rename it as initdup and edit controlfile location, dbname
4. db_file_name_convert=(target path,dup db path)
lof_file_name_convert=(target path,dup db path)
5. export ORACLE_SID=dup sqlplus / as sysdba startup nomount
6. create spfile from pfile
7. using RMAN for duplicating db
export ORACLE_SID=dup
rman target uname/pass@targetdb catalog uname/pass@catalogdb auxiliary /
duplicate target database to dup;
or duplicate target database to dup until time 'sysdate-4'


No comments:

Post a Comment