You are on page 1of 21

1

CREATING ORACLE DATABASE - DBCA


If you want to create additional databases with the release software that you just installed, then
you can use the Database Configuration Assistant (DBCA).
DBCA enables you to perform the following tass!
Creating a Database with DBCA
Configuring Database "ptions with DBCA
Deleting a Database with DBCA
#anaging $emplates with DBCA
Configuring Automatic %torage #anagement with DBCA
"nline &elp is a'ailable by clicing &elp. It pro'ides information that guides you in selecting
configuration options.
Starting DBCA
$o launch DBCA!
(. )og on to your computer as a member of the administrati'e group that is authori*ed to
install "racle software and create and run the database.
+. $o launch DBCA on a ,indows operating system, clic %tart and then select -rograms,
"racle . home/name, Configuration and #igration $ools, and then Database
Configuration Assistant.
$o launch the DBCA on 01I2, or as another method on a ,indows operating system,
enter the following command at a system prompt!
dbca
$he dbca utility is typically located in "3AC)4/&"#45bin.
$he ,elcome window appears.
6. Clic 1e7t to continue. $he DBCA "perations window appears.
Creating a Database with DBCA
"n the DBCA "perations window, select Create a Database to start a wi*ard that enables you to
create and configure a database. $he wi*ard re8uests your input on the following!
Database $emplates
Database Identification
#anagement "ptions
2
Database Credentials
%torage "ptions
Database 9ile )ocations
3eco'ery Configuration
Database Content
Initiali*ation -arameters
Database %torage
Database Creation "ptions
1ote that most windows of the wi*ard pro'ide a default setting. $o accept all the default
parameters, you can clic 9inish at any step. DBCA displays a final confirmation window. Clic
": to initiate the database creation.
Database Templates
$his window enables you to select the type of database you want to create. By default, "racle
ships pre.defined templates. $here are templates for Data ,arehouse, ;eneral -urpose, and
$ransaction -rocessing databases.
$he templates contain settings optimi*ed for worload. Clic %how Details to see the
configuration for each type of database. Choose the template suited to the type of worload your
database will support. If you are not sure which to choose, select the default ;eneral -urpose
template.
9or more comple7 en'ironments, you can select the Custom Database option. $his option results
in a more e7tensi'e inter'iew, which means that it will tae longer to create your database
because a database creation script must be run.
Database Identifiati!n
In the ;lobal Database 1ame bo7, enter the database name in the form
database/name.domain/name.
In the %ID bo7, enter the "racle system identifier. $he %ID defaults to the database name and
uni8uely identifies the instance that runs the database.
"anagement Opti!ns
0se this window to set up your database so it can be managed with "racle 4nterprise #anager.
"racle 4nterprise #anager pro'ides ,eb.based management tools for indi'idual databases, as
well as central management tools for managing your entire "racle en'ironment.
3
Chec Configure the Database with 4nterprise #anager to use 4nterprise #anager. %elect one of
the following options!
If the "racle #anagement Agent has been installed on your host computer, then you ha'e
the option of selecting central management by selecting 0se ;rid Control for Database
#anagement. If you select this type of management, you must also indicate which
management ser'ice to use in the drop.down menu.
%elect 0se Database Control for Database #anagement to manage your database locally.
If you choose this option, you can additionally chec 4nable 4mail 1otifications for
"racle to e.mail you alerts regarding potential problems, and chec 4nable Daily
Bacup. Clic &elp for more information about these options.
Database Credentials
In this window, you specify the passwords for the administrati'e accounts such as %<% and
%<%$4#. %elect one of the following options!
%elect 0se the %ame -assword for All Accounts and enter the password to use the same
password for all accounts.
%elect 0se Different -asswords and specify passwords indi'idually.
St!rage Opti!ns
%pecify the type of storage mechanism you would lie your database to use.
Database #ile L!ati!ns
In this window, you specify the "racle home and directory path in which to install the "racle
software. Choose one of the following!
0se Database 9ile )ocations from $emplate=%electing this option instructs the DBCA
to use the directory information as specified in the template. )ater, you can mae
modifications to database filenames and locations.
0se Common )ocation for All Database 9iles=$his option re8uires you to specify a new
directory for the "racle home. All the database files will be created in this location. )ater,
you can mae modifications to database filenames and locations.
0se "racle.#anaged 9iles=%elect this option to ha'e "racle directly manage operating
system files comprising an "racle database. <ou specify default location called a
database area for all your files. "racle thereafter automatically creates and deletes files in
this location as re8uired. <ou can also create multiple copies of your redo and online log
files by selecting #ultiple7 3edo )ogs and Control 9iles. $o learn more about redo logs
and control files.
%electing this option enables you to delegate the complete management of database files
to the database. <ou no longer need to specify the filenames, location, or their si*es.
4
Re!$er% C!nfig&rati!n
,hen you create a new database, it is important to configure the database so you can reco'er
your data in the e'ent of a system failure. <ou can select the following options!
%pecify 9lash 3eco'ery Area=%elect this option to specify a bacup and reco'ery area
and specify its directory location and si*e. <ou can use 'ariables to identify standard
locations. $o re'iew or add additional locations, clic 9ile )ocation >ariables at the
bottom of the window.
4nable Archi'ing=%elect this option to enable archi'ing of database redo logs, which
can be used to reco'er a database. %electing this option is the same as enabling Archi'e
)og #ode in "racle 4nterprise #anager or running the database in A3C&I>4)";
mode. <ou can accept the default archi'e mode settings or change them by selecting 4dit
Archi'e #ode -arameters.
"racle recommends you select 4nable Archi'ing. %electing this option pro'ides better
protection for your database in the case of software or hardware failure. If you do not
select this option now, you can enable archi'e log mode later.
Database C!ntent
,hen you create your database, you can load it with data.
%ample %chemas
Chec %ample %chemas to include the %ample %chemas (42A#-)4) tablespace in your
database. $he %ample %chemas pro'ide a common platform for e7amples. "racle boos and
educational materials contain e7amples based upon the %ample %chemas. "racle recommends
they be included in your database.
Custom %cripts
In the Custom %cripts tab, you can specify one or more %?) scripts to run after your database is
created. %cripts are useful for performing post.installation tass, such as loading custom
schemas. $o specify scripts, chec 3un the following scripts@ otherwise accept the default 1o
scripts to run. 1ote that if you choose to run scripts after installation, your scripts must include a
connect string that identifies the database. Clic &elp for more information.
Initiali'ati!n (arameters
$he lins on this window pro'ide access to windows that enable you change default initiali*ation
parameter settings. $hese parameters fall into the following categories!
#emory
%i*ing
5
Character %ets
Connection #ode
"em!r%
0se this window to set the initiali*ation parameters that control how the database manages its
memory usage. <ou can choose from one of the following approaches to memory management!
$ypical=$his method re8uires little configuration, and allocates memory as a percentage of
total o'erall physical system memory. %elect $ypical and enter a percentage 'alue. Clic %how
#emory Distribution to see how much memory the DBCA assigns to the %ystem ;lobal Area
(%;A) and the -rogram ;lobal Area (-;A). Custom=$his method re8uires more configuration,
but gi'es you more control o'er how the database uses system memory. $his option is meant for
more e7perienced database administrators. <ou can directly specify memory si*es for the %;A
and -;A and their sub.structures, such as the shared pool and buffer cache.
%elect one of the following options!
%elect Automatic to allocate specific amounts of memory to %;A and -;A.
%elect #anual to enter specific 'alues for each %;A component. $his will customi*e how
the %;A memory is distributed among the %;A memory substructures.
Si'ing
In this tab, you specify the smallest bloc si*e and the ma7imum number of operating system
user processes that can simultaneously connect to the database.
In the Bloc %i*e list, enter the si*e in bytes or accept the default. "racle Database data is stored
in these blocs. "ne data bloc corresponds to a specific number of bytes of physical space on
dis. ,hile using pre.defined templates, this field is not enabled since the database will be
created with the default bloc si*e of A :B. But while using the custom option, you can change
bloc si*e. %electing a bloc si*e other than the default A :B 'alue re8uires ad'anced nowledge
and should only be done when absolutely re8uired.
In the -rocesses field, specify the ma7imum number of processes that can simultaneously
connect to the database. 4nter a number or accept the default of (BC. $he default 'alue for this
parameter is good enough for many en'ironments. $he 'alue should be D or greater. $his 'alue
should allow for all bacground processes, such as locs and parallel e7ecution processes.
Charater Sets
0se this window to define the character sets used by your database. Character sets are the
encoding schemes used to display characters on your computer screen. Choosing a character set
determines what languages can be represented in the database.
6
9or Database Character %et, select from one of the following options!
0se the Default=%elect this option if you need to support only the language currently
used by the operating system for all your database users and your database applications.
0se 0nicode (A)6+0$9A)=%elect this option if you need to support multiple languages
for your database users and your database applications.
Choose from the list of character sets=%elect this option if you want the "racle Database
to use a character set other than the default character set used by the operating system.
In the 1ational Character %et list, select a character set or accept the default. $he national
character set is an alternati'e character set that enables you to store 0nicode characters in a
database that does not ha'e a 0nicode database character set. Choosing a national character can
mae programming in the national character set easier.
In the Default )anguage list, select a default database language or accept the default. $he default
language determines how the database supports locale.sensiti'e information such as day and
month abbre'iations, default sorting se8uence for character data, and writing direction (left or
right).
In the Default Date 9ormat list, select a date format or accept the default. $he default date format
determines the con'ention for displaying the hour, day, month, and year. 9or e7ample, in the
0nited :ingdom, the date format is DD.##.<<<<.
C!nneti!n "!de
0se this window to select the database mode. <ou can run the database in either of the following
modes!
Dedicated %er'er #ode allows a dedicated ser'er process for each user process. %elect
this option when the number of total clients is e7pected to be small, or when database
clients will mae persistent, long.running re8uests to the database.
%hared %er'er #ode allows se'eral client connections to share a database.allocated pool
of resources. 0se this mode when a large number of users need to connect to the
database. It is also useful when database memory is limited or when better performance is
needed, because you can ha'e more client connections to the database than in dedicated
ser'er mode. If you choose shared ser'er mode, then you must also indicate the number
of ser'er processes you want to create when an instance is started. 9or more information
about setting this parameter, clic &elp.
Database St!rage
A na'igation tree displays the storage structure of your database (control files, datafiles, redo log
groups, and so forth). If you are not satisfied with the storage structure or parameters, then you
can mae changes. <ou can create a new object with Create and delete e7isting objects with
Delete.
7
1ote that if you selected one of the preconfigured templates for a database, then you cannot add
or remo'e control files, datafiles, or undo segments.
Database Creati!n Opti!ns
Chec any of the following options for creating the database!
Create Database=Chec to create your database at this time.
%a'e as a Database $emplate=Chec to sa'e the database definition as a template to use
at another time.
;enerate Database Creation %cripts=Chec to generate a %?) database creation script
that you can run at a later time.
C!nfig&ring Database Opti!ns with DBCA
In the "perations window, select Configure Database "ptions to change 'arious aspects of your
database configuration. 9or e7ample, you can change the database from a dedicated ser'er to a
shared ser'er. <ou can add database options that ha'e not been pre'iously configured for use
with your database, for e7ample, "racle )abel %ecurity or "racle ")A-.
Deleting a Database with DBCA
In the "perations window, select Delete a Database to remo'e a database from the system. ,hen
you select this option, DBCA deletes all the files associated with this database. "n ,indows,
any associated ser'ices are also deleted.
"anaging Templates with DBCA
DBCA templates are 2#) files that contain information re8uired to create a database. $emplates
are used in DBCA to create new databases and clone e7isting databases. $he information in
templates includes database options, initiali*ation parameters, and storage attributes (for
datafiles, tablespaces, control files, and online redo logs).
$emplates can be used just lie scripts, but they are more powerful than scripts because you ha'e
the option of cloning a database. Cloning sa'es time by copying a seed databaseEs files to the
correct locations.
$emplates are stored in the following directory!
"3AC)4/&"#45assistants5dbca5templates
Ad$antages !f )sing Templates
0sing templates has the following ad'antages!
8
$ime sa'ing. If you use a template you do not ha'e to define the database.
4asy Duplication. By creating a template containing your database settings, you can
easily create a duplicate database without specifying parameters twice.
4asy editing. <ou can 8uicly change database options from the template settings.
4asy sharing. $emplates can be copied from one machine to another.
$he following e7ample creates a database by passing command.line arguments to DBCA!
dbca .silent .createDatabase .template1ame ;eneral/-urpose.dbc
.gdbname ora((g .sid ora((g .response9ile 1"/>A)04 .character%et A)6+0$9A
.memory-ercentage 6C .emConfiguration )"CA)
4nter %<%$4# user password!
password
4nter %<% user password!
password
Copying database files
(F complete
6F complete
...
"ODI#*ING DATABASE INITIALI+ATION (ARA"ETERS
$he ser'er parameter file is a binary file and therefore cannot be edited manually. $o change
'alues in the ser'er parameter file, you must e7port it to an editable format, mae changes, and
then import it bac into a ser'er parameter file, or use the ALTER SYSTEM SET statement to
change the ser'er parameter 'alues.
C"##A1D ! C34A$4 -9I)4 93"# %-9I)4@

,ill create te7t file init.ora. 4dit this.
$hen again use C34A$4 %-9I)4 93"# -9I)4.
As an alternati'e to e7porting, editing, and importing the ser'er parameter file, as described in
the pre'ious section, you can use the %?) A)$43 %<%$4# %4$ statement to change
initiali*ation parameter 'alues. #ae sure that you use the %C"-4 clause to apply the change in
the ser'er parameter file.
By default, the scope is set to B"$& if a ser'er parameter file was used to start up the instance,
and the scope is set to #4#"3< if an initiali*ation parameter file was used to start up the
instance. $he following e7ample adds a new local archi'e log destination to the ser'er parameter
file!
%?)G A)$43 %<%$4# %4$ )";/A3C&I>4/D4%$/HI
+G E)"CA$I"1I5dis(5oracle5oradata5payroll5E,
6G E#A1DA$"3<E, E34"-41I+E %C"-4I%-9I)4@
9
Orale database start&p stages and !mmands
%imply starting an "racle database with startup command is not too comple7. Actually it is just
running a few commands and your database will come up happily and be ready for normal
operation.
9or e7ample to start your "racle database you can just login and e7ecute startup command as
follows.
$sqlplus / as sysdba
SQL>startup

$his command will start your database.
But in the bacground there are a few stages that are hidden when you use the abo'e command.
0nderstanding these stages will help you to get a better insight 'iew of "racle startup process.
"racle startup process consists of three stages
Stage ,- NO"O)NT
Stage .- "O)NT
Stage /- O(EN

Stage ,- NO"O)NT
$his is the first stage in the startup process. <ou can start "racle database in nomount mode
using the command
SQL>startup nomount
,hen you e7ecute the abo'e command, an "racle instance is started. ,hen instance starts it will
read the initialisation file (commonly nown as parameter file) called init.ora file. 9rom this
parameter file the instance will now about the si*e of %;A, -;A, database buffer si*e and other
configurable parameters. $he instance will also start the "racle bacground process such as
(-#"1, %#"1, );,3 etc). $his stage also opens the alert log and the trace files.

Stage .- "O)NT
$he ne7t stage after 1"#"01$ is called #"01$. <ou can manually start an "racle database
in #"01$ stage using the command
SQL>startup mount
"r when database is already in nomount stage then you can change the stage by running the
command
SQL>alter database mount;

,hen database goes into mount stage, it will read the control files specified in the parameter file.
3emember the parameter file was read in the first stage (nomount). $he control files contain the
information about the physical structure of the database. %o the control file will ha'e the names
and locations of all the datafiles and online redo log files. At this stage these datafiles and log
files are not opened.

%ome database administration operations can only be performed when the "racle database is
#"01$ stage. 9or e7ample "racle full database reco'ery can be done only when the database
is in mount stage. If you want to rename a datafile you may need to tae the database to mount
stage unless the tablespace of the datafile is already offline.

10
Stage /- O(EN
$he final stage in the "racle startup process. ,hen the database is open then only normal
database operations can taes place. ,hich means users and applications can login and start
reading5writing data.
3unning the command below will start the "racle database and put into "-41 stage.
SQL>startup
And if the database is already in #"01$ stage then you can open the database using the
command
SQL> alter database open;

,hen database is open it will open the datafiles and redo log files. If any of these files are
missing or corrupted then "racle will not open successfully and will return error.
"racle Database %hutdown %tages
Database Sh&td!wn !pti!ns-
NOR"AL . 1o new connections, waits for all users to disconnect, closes and
dismounts database before instance shutdown, no instance reco'ery re8uired upon
ne7t db startup.
I""EDIATE . 3olls bac all current uncommitted t7ns and disconnects users,
closes and dismounts database before instance shutdown, no instance reco'ery
re8uired upon ne7t db startup.
TRANSACTIONAL . 1o new connections, users disconnected when their
current t7n is completed, when all Jcurrent t7ns are complete shutdown
immediate is e7ecuted.
ABORT . All t7ns are terminated, no t7ns are rolled bac, instance terminated
without closing the data files, ne7t startup will re8uire instance reco'ery.
0iewing the Alert L!g
<ou can 'iew the alert log with a te7t editor, with 4nterprise #anager, or with the AD3CI
utility.
$o 'iew the alert log with 4nterprise #anager!
(. Access the Database &ome page in 4nterprise #anager.
+. 0nder 3elated )ins, clic Alert )og Contents.
$he >iew Alert )og Contents page appears.
6. %elect the number of entries to 'iew, and then clic ;o.
$o 'iew the alert log with a te7t editor!
(. Connect to the database with %?)K-lus or another 8uery tool, such as %?) De'eloper.
+. ?uery the >LDIA;/I19" 'iew
6. $o 'iew the te7t.only alert log, without the 2#) tags, complete these steps!
(. In the >LDIA;/I19" 8uery results, note the path that corresponds to the Diag
$race entry, and change directory to that path.
+. "pen file alert/%ID.log with a te7t editor.
H. $o 'iew the 2#).formatted alert log, complete these steps!
(. In the >LDIA;/I19" 8uery results, note the path that corresponds to the Diag
Alert entry, and change directory to that path.
+. "pen the file log.7ml with a te7t editor.
11
D*NA"IC (ER#OR"ANCE 0IE1S
"racle contains a set of underlying 'iews that are maintained by the database ser'er and
accessible to the database administrator user %<%. $hese 'iews are called dynamic performance
'iews because they are continuously updated while a database is open and in use, and their
contents relate primarily to performance.
Although these 'iews appear to be regular database tables, they are not. $hese 'iews pro'ide
data on internal dis structures and memory structures. <ou can select from these 'iews, but you
can ne'er update or alter them.
02 0iews
$he actual dynamic performance 'iews are identified by the prefi7 >/L. -ublic synonyms for
these 'iews ha'e the prefi7 >L. Database administrators and other users should access only the
>L objects, not the >/L objects.
G02 0iews
9or almost e'ery >L 'iew "racle has a corresponding ;>L (global >L) 'iew. 4ach ;>L 'iew
contains an e7tra column named I1%$/ID of datatype 10#B43. $he I1%$/ID column
displays the instance number from which the associated >L 'iew information was obtained.
%?)G %4)4C$ K 93"# ;>L)"C: ,&434 I1%$/ID I + "3 I1%$/ID I B@
C!nsistent and In!nsistent Ba3&ps
A bacup can be consistent or inconsistent. A bacup is consistent when there are no changes in
the redo log that ha'e not already been applied to the datafiles at the time of the bacup.
$o mae a consistent bacup, your database must ha'e been shut down normally. It cannot be
reopened for the duration of the bacup. In shutting down the database, all committed changes in
the redo log are written to the datafiles, so the datafiles are in a transaction.consistent state. $his
process is nown as an offline bacup because the entire database is offline for the duration of
the bacup.
In contrast to a consistent bacup, an inconsistent bacup is made while the database is open. In
an inconsistent bacup, the online redo logs contain changes that ha'e not yet been applied to the
datafiles. $he datafiles are not in a transaction.consistent state. $he database must be run in
A3C&I>4)"; mode to preser'e the redo log. $he online redo log at the moment of the bacup
must be archi'ed and baced up along with the datafiles to preser'e these changes.
&ere below is the simplest JconsistentJ Bacup and 3estore using 3#A1 !
C!MGrman
3eco'ery #anager! 3elease (C.+.C.6.C . -roduction on $hu #ay A ++!+C!(N +CCA
Copyright (c) (OA+, +CCB, "racle. All rights reser'ed.
$" BAC:0-
3#A1G connect target 5
#A1G startup mount
3#A1G bacup database@
3#A1G shutdown
12
$" 34%$"34
3#A1G connect target 5
3#A1G startup nomount
3#A1G restore controlfile from autobacup@
$A:I1; BAC:0- ,I$&"0$ %&0$D",1
%?)G Alter database begin backup;
Select * from v$backup;
Alter database end backup;
Alter system archive log current;
Alter database backup controlfile to <path>\ backup filename
C34A$I1; I1C34#41$A) BAC:0-
Incremental bacups can be either le'el C or le'el (. A le'el C incremental bacup, which is the
base for subse8uent incremental bacups, copies all blocs containing data, bacing the datafile
up into a bacup set just as a full bacup would.
3#A1G BAC:0- I1C34#41$A) )4>4) ( DA$ABA%4@
3#A1G BAC:0- I1C34#41$A) )4>4) ( C0#0)A$I>4 DA$ABA%4@
3#A1G BAC:0- I1C34#41$A) )4>4) (
$AB)4%-AC4 %<%$4#
DA$A9I)4 Eora/home5oradata5trgt5toolsC(.dbfE@
BAC4)( CONTROL #ILE TO TRACE
0se the A)$43 DA$ABA%4 BAC:0- C"1$3")9I)4 statement to bac up your control
files. <ou ha'e two options!
Bac up the control file to a binary file (duplicate of e7isting control file) using the
following statement!
A)$43 DA$ABA%4 BAC:0- C"1$3")9I)4 $" E5oracle5bacup5control.bpE@
-roduce %?) statements that can later be used to re.create your control file!
A)$43 DA$ABA%4 BAC:0- C"1$3")9I)4 $" $3AC4@
#"1I$"3 9)A%& 34C">43< A34A
"racle 9lash 3eco'ery Area (93A) was the name of one of the basic components of the 3#A1
en'ironment.
$he 93A is essentially a dis location for the storage of files related to the reco'ery process.
$hese files in the 93A are managed by "racle and 3#A1 automatically. 9iles that could be
found in the 93A include!
3#A1 bacups
control file
logs
o online redo log copies
o archi'ed redo logs
o flashbac logs
&ere is a 8uery to see the si*e of the 93A!
13
set lines (CC
col name format aDC
select
name,
floor(space/limit 5 (C+H 5 (C+H) J%i*e #BJ,
ceil(space/used 5 (C+H 5 (C+H) J0sed #BJ,
from
'Lreco'ery/file/dest
order by
name@
(ER#OR"ING DATABASE RECO0ER*
RECO0ER #RO" LOSS O# A CONTROL #ILE
0se the following procedure to rebuild the control file!
(. Bacup all e7isting files.
+. %tart up %?)K-lus.
6. Issue the %$A3$0- 1"#"01$ command.
H. Issue the C34A$4 C"1$3")9I)4 command.
B. Issue the A)$43 DA$ABA%4 #"01$ command.
D. Apply the re8uired reco'ery to the database files. 0se the 34C">43 DA$ABA%4
command
N. %hutdown cleanly (issue %&0$D",1 with no options or %&0$D",1 I##4DIA$4)
A. Bacup the reco'ered database.
O. 3estart the database.
TO RECO0ER #RO" T5E LOSS O# AN ACTI0E REDO LOG #ILE-
(. )ogin as the oracle user.
+. %hut down the database using the following %?)K-lus commands!
C"114C$ %<% A% %<%DBA
%&0$D",1 AB"3$
6. 47it from %?)K-lus and ha'e the system administrator bac up all database files. $his
pro'ides you with a restart point in case the rest of the reco'ery fails.

H. Correct the problem that caused the failure, or find a new location for the redo logs.

B. &a'e the system administrator restore all database files using the latest bacup, but not
the bacup from step +.
D. %tart the database and mount it by issuing the following %?)K-lus commands!

N. C"114C$ %<% A% %<%DBA
%$A3$0- #"01$
A. #ae sure all database files are online by e7ecuting the following command for each file!

14
A)$43 DA$ABA%4 DA$A9I)4 EfilenameE "1)I14
,here EfilenameE is the full path file name, enclosed in single 8uotes. If a database is
reco'ered with a data file off.line, that files data is lost.
O. If the original location of the redo logs has become in'alid, rename the files with the
following %?)K-lus command!

A)$43 DA$ABA%4 341A#4 9I)4 EoldE $" EnewE
,here old and new are full path file names enclosed in single 8uotes. 4ach file must be
renamed if its location has changed.
(C. 3eco'er the database in manual mode using the command!

34C">43 DA$ABA%4 #A10A)
"3AC)4 will prompt for the names of the re8uired A3C&I>4 files, beginning with the
oldest file. All re8uired logs should be online. After each log is applied, the system will
re8uest the ne7t one in the se8uence. ,hen the log just prior to the damaged log is
applied, issue the CA1C4) command to abort the reco'ery operation. 3eco'ery is
complete at this point. All data in the damaged redo log is lost and must be re.entered.
((. 3e.start the database by issuing the following %?)K-lus command!

A)$43 DA$ABA%4 "-41 34%4$)";%
$he 34%4$)";% option will initiali*e the set of redo logs and start a new se8uence of
archi'e log files.
(+. "nce the database is open, immediately shut it down by issuing one of these commands
from %?)K-lus!

(6. %&0$D",1
%&0$D",1 I##4DIA$4
(H. 47it from %?)K-lus and ha'e the system administrator mae a complete bacup of the
"racle system. All pre'ious archi'e logs are now in'alid and may be disposed of.
(B. 0sing %?)K-lus, restart the "racle instance.
RECO0ERING CRITICAL #ILES
3eco'ering critical files would include control files
s8lG alter database bacup controlfile to trace@ (file located in 0%43/D0#-/D4%$)
c!MG edit the trace file and obtain the controlfile create part
s8lG Pc!Mrestore/controlfile.t7t (file obtained from the abo'e information obtained from the
trace file)
RECO0ERING NON-CRITICAL #ILES
3eco'ering non.critical files would include temporary tablespaces, redo log files, inde7
tablespaces, read.only tablespace, password file.
Temp!rar% tablespaes
15
$emporary tablespace are written to by the ser'er processes ser'icing the sessions, if the
temporary tablespace is damaged or missing the database would still open fully but you would
get a error message in the alert log, remember that as soon as a user uses the temporary
tablespace he would get an error. $emporary tablespaces do not regenerate redo log information.
(. Create a new temporary tablespace
+. %witch users o'er to the new temporary tablespace (should be able to switch default
temporary tablespace)
s8lG alter database default temporary tablespace temp+@
s8lG select property/'alue from database/properties where
property/nameIQD49A0)$/$4#-/$AB)4%-AC4Q@
6. Drop the damaged tablespace
"O0ING DATA
Orale Data (&mp Arhitet&re
A major part of the Data -ump infrastructure replaces the imp (import) and e7p (e7port)
programs from pre'ious 'ersions of "racle and is designed to pro'ide significant performance
increases o'er them. Data -ump pro'ides new methods of mo'ing data between databases,
including the use of specially formatted files (as was the case with imp5e7p) as well as a new
networ mode of data transport.
N!te- $he "racle e7p and imp utilities are still a'ailable in "racle (Cg and the Data -ump can
read e7port files created by the e7p process. &owe'er, the e7p and imp utilities do not support all
of "racle (CgEs new features.
$he Data -ump architecture contains a number of components, as listed and described in the
table below.
C!mp!nent
Name
(&rp!se
Direct -ath A-I
(D-A-I)
D-A-I supports a direct interface between the database and the Data -ump.
47ternal $able
%er'ices
An access dri'er introduced in "racle (Cg, "3AC)4/DA$A-0#-, allows
"racle to both read and write to e7ternal files. $his A-I uses an "racle
proprietary format when writing to the e7ternal file.
dbms/metadata
pacage
$his pacage is used to pro'ide object definitions to the Data -ump for use
when an object needs to be re.created.
dbms/datapump
pacage
$his pacage pro'ides the interface for the Data -ump utilities to call. $he
utilities, impdp and e7pdp, are really just thin clients that call this pacage.
%?)K)oader
%?)K)oader has been fully integrated with e7ternal tables in "racle (Cg.
$his allows for automatic migration of %?)K)oader control files with
e7ternal table access parameters.
impdp and e7pdp
clients
$hese two programs mae calls to the dbms/datapump pacage for all
database.related Data -ump operations.
"ther e7ternal
clients
"ther "racle clients that tae ad'antage of the Data -ump infrastructure
include "racle 4nterprise #anager, replication, transportable tablespaces,
etc. Additionally, you can interface with the procedure dbms/datapump from
16
a client lie %?)K-lus.
$he dump file set
$his is the formatted flat file(s) that gets created by the e7pdp client. 1ote
that unlie the e7p utility, the dump file set is always created on the ser'er,
ne'er on the client.
N!te- "racle recommends that you not log in using sysdba pri'ileges when using the Data -ump
utilities, because the sysdba login grants special pri'ileges that you will generally not need with
Data -ump.
Internally, Data -ump processes taes place in two different stages! the preparation stage and the
e7ecute stage. In the preparation stage, the client starts the #aster Control -rocess (#C-). #ost
of the Data -ump operation centers around the #C-. At the same time 8ueues are established for
communication between the #C- and the client and other processes that will be started.
$he e7ecute stage begins once e'erything is set up on the client side. At this point, if the process
is an e7port process, the initial dump file set is created and worer processes are started. If the
process is an import process, the dump file set is opened. $he #C- then controls the
e7port5import processes, directing the worer processes to write or e7tract the re8uired
information. During processing, worer processes spawn off parallel ser'er sla'es to pro'ide the
degree of parallelism that is re8uired.
During this process, "racle creates a master table to eep trac of the status of the process. $his
master table is critical and allows for restartable operations. $he master table is also loaded into
the dump file set being created during an e7port. 1ote that this master table is critical to
reco'ering your database from the e7port dump file set. "nce the e7port or import has
completed, the processes then shuts down. Also, "racle remo'es the master table once the Data
-ump process has completed if the job is successful or it is terminated with the ill/job
command from the impdp or e7pdp client. If a job is aborted for unnown reasons (for e7ample,
an error) or if the stop/job command is used from the impdp or e7pdp client, the master table
will be retained to allow the Data -ump job to be restarted.
Ass!iiated Data Diti!nar% 0iews
$here are se'eral data dictionary 'iews a'ailable that allow you to to manage and monitor Data
-ump operations. $hese 'iews are listed and described in the following table!
0iew Name (&rp!se6Desripti!n
DBA/DA$A-0#-/R"B%
Displays information on running Data -ump jobs. Also comes
in the 0%43/DA$A-0#-/R"B% 'ariety.
DBA/DA$A-0#-/%4%%I"1% -ro'ides session.le'el information on Data -ump jobs.
DA$A-0#-/-A$&%
-ro'ides a list of 'alid object types that you can associate with
the include or e7clude parameters of e7pdp or impdp.
"racle Data -ump is a newer, faster and more fle7ible alternati'e to the Je7pJ and JimpJ utilities
used in pre'ious "racle 'ersions
9or the e7amples to wor we must first unloc the %C"$$ account and create a directory object
it can access. $he directory object is only a pointer to a physical directory, creating it does not
actually create the physical directory on the file system of the database ser'er.
17
C"11 5 A% %<%DBA
A)$43 0%43 scott ID41$I9I4D B< tiger ACC"01$ 01)"C:@
C34A$4 "3 34-)AC4 DI34C$"3< test/dir A% E5uC(5app5oracle5oradata5E@
;3A1$ 34AD, ,3I$4 "1 DI34C$"3< test/dir $" scott@
47isting directories can be 8ueried using the A))/DI34C$"3I4% 'iew.
1ote. Data -ump is a ser'er.based technology, so it typically deals with directory objects
pointing to physical directories on the database ser'er. It does not write to the local file system
on your client -C.
Table E7p!rts6Imp!rts
$he $AB)4% parameter is used to specify the tables that are to be e7ported. $he following is an
e7ample of the table e7port and import synta7.
e7pdp scott5tigerPdb(Cg tablesI4#-,D4-$ directoryI$4%$/DI3 dumpfileI4#-/D4-$.dmp
logfileIe7pdp4#-/D4-$.log
impdp scott5tigerPdb(Cg tablesI4#-,D4-$ directoryI$4%$/DI3 dumpfileI4#-/D4-$.dmp
logfileIimpdp4#-/D4-$.log
$he $AB)4/42I%$%/AC$I"1IA--41D parameter allows data to be imported into e7isting
tables.
Shema E7p!rts6Imp!rts
$he ",143 parameter of e7p has been replaced by the %C&4#A% parameter which is used to
specify the schemas to be e7ported. $he following is an e7ample of the schema e7port and
import synta7.
e7pdp scott5tigerPdb(Cg schemasI%C"$$ directoryI$4%$/DI3 dumpfileI%C"$$.dmp
logfileIe7pdp%C"$$.log
impdp scott5tigerPdb(Cg schemasI%C"$$ directoryI$4%$/DI3 dumpfileI%C"$$.dmp
logfileIimpdp%C"$$.log
Database E7p!rts6Imp!rts
$he 90)) parameter indicates that a complete database e7port is re8uired. $he following is an
e7ample of the full database e7port and import synta7.
18
e7pdp system5passwordPdb(Cg fullI< directoryI$4%$/DI3 dumpfileIDB(C;.dmp
logfileIe7pdpDB(C;.log
impdp system5passwordPdb(Cg fullI< directoryI$4%$/DI3 dumpfileIDB(C;.dmp
logfileIimpdpDB(C;.log
LOAD DATA 1IT5 S8L LOADER
%?)K)oader is a bul loader utility used for mo'ing data from e7ternal files into the "racle
database. %?)K)oader supports 'arious load formats, selecti'e loading, and multi.table loads.
SQL*Loader (sqlldr) is the utility to use for high performance data loads !he data can be
loaded from any te"t file and inserted into the database
"ne can load data into an "racle database by using the s9lldr (s8lload on some platforms)
utility. In'oe the utility without arguments to get a list of a'ailable parameters. )oo at the
following e7ample!
s8lldr usernamePser'er5password controlIloader.ctl
s8lldr username5passwordPser'er controlIloader.ctl
$his sample control file (loader.ctl) will load an e7ternal data file containing delimited data!
load data
infile Ec!MdataMmydata.cs'E
into table emp
fields terminated by J,J optionally enclosed by EJE
( empno, empname, sal, deptno )
$he mydata.cs' file may loo lie this!
(CCC(,J%cott $igerJ, (CCC, HC
(CCC+,J9ran 1audeJ, BCC, +C
Data "!$ement with E7ternal table and datap&mp
In this article we will see that with the help of e7ternal table and datapump we can mo'e the
Data across the "racle database easily.
19
DATA "O0E"ENT 1IT5 E:TERNAL TABLE AND DATA()"(
Intr!d&ti!n
47ternal tables pro'ided a new means of reading flat file data without first loading it into a
staging table. "racle (Cg has taen e7ternal tables a stage further by enabling an e7ternal table to
be created as a C$A% (Create $able As %elect) operation, which enables a one.time unloading of
data. "racle has supplied a new access dri'er nown as J"3AC)4/DA$A-0#-J which means
that "racle will JunloadJ an e7ternal table to a proprietary format usable by the Data -ump set of
utilities (significant new (Cg feature to replace imp and e7p).
%ource Database 1ame.DIA)
$arget Database 1ame."3C)
A simple dem!nstrati!n;
%?)G C34A$4 DI34C$"3< dial/dir A% ED!MoracleMdialE@
Directory created.
%?)G C34A$4 $AB)4 dial
+ "3;A1ISA$I"1 42$431A)
6 (
H $<-4 "3AC)4/DA$A-0#-
B D49A0)$ DI34C$"3< dial/dir
D )"CA$I"1 (Edial.dmpE)
N )
A A%
O %4)4C$ K
(C 93"# all/objects@
$able created.
After the Creation of the e7ternal table is finish in Dial Database. )ets see the e7ternal table in
Dial Database.
%?)G desc dial
1ame 1ullT $ype
......................................... ........ .................
",143 >A3C&A3+(6C)
"BR4C$/1A#4 >A3C&A3+(6C)
%0B"BR4C$/1A#4 >A3C&A3+(6C)
"BR4C$/ID 10#B43
DA$A/"BR4C$/ID 10#B43
"BR4C$/$<-4 >A3C&A3+((O)
20
C34A$4D DA$4
)A%$/DD)/$I#4 DA$4
$I#4%$A#- >A3C&A3+((O)
%$A$0% >A3C&A3+(N)
$4#-"3A3< >A3C&A3+(()
;4143A$4D >A3C&A3+(()
%4C"1DA3< >A3C&A3+(()
%?)G %4)4C$ C"01$(K) 93"# dial@
C"01$(K)
..........
HN6NH
"!$ing the e7ternal table fr!m Dial database t! Orl database fr!m !ne shema t! an!ther
with the help !f datap&mp &tilit%
Connect to the "rcl database as system user
%?)G C34A$4 DI34C$"3< orcl/dir A% ED!MoracleM"rclE@
%?)G grant read on directory orcl/dir to scott@
;rant succeeded.
%?)G grant write on directory orcl/dir to %cott@
;rant succeeded.
1ow e7port the e7ternal table dial from the dial database.
%et "3AC)4/%IDIDIA)
C!MDocuments and %ettingsMasoodGe7pdp system5KKKKKKK D0#-9I)4Itest.dmp
directoryIdial/dir tablesIdial
47port! 3elease (C.+.C.(.C . -roduction on $hursday, (A #ay, +CCD (N!CC!6C
Copyright (c) +CC6, +CCB, "racle. All rights reser'ed.
Connected to! "racle Database (Cg 4nterprise 4dition 3elease (C.+.C.(.C U -roduction ,ith the
-artitioning, ")A- and Data #ining options
9)A%&BAC: automatically enabled to preser'e database integrity.
%tarting J%<%$4#J.J%<%/42-"3$/$AB)4/C(J! system5KKKKKKKK D0#-9I)4Itest.dmp
directoryIdial/dir tablesIdial
4stimate in progress using B)"C:% method...
-rocessing object type $AB)4/42-"3$5$AB)45$AB)4/DA$A
$otal estimation using B)"C:% method! C :B
-rocessing object type $AB)4/42-"3$5$AB)45$AB)4
#aster table J%<%$4#J.J%<%/42-"3$/$AB)4/C(J successfully loaded5unloaded
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
Dump file set for %<%$4#.%<%/42-"3$/$AB)4/C( is!
D!MoracleMdialM$4%$.D#-
Rob J%<%$4#J.J%<%/42-"3$/$AB)4/C(J successfully completed at (N!CC!HA
21
1ow we will import the dial table to %cott schema in "rcl Database. Copy the dial.dmp from
d!MoracleMdial to d!MoracleMorcl ($his is the main file where all the data is there for dial table).
Copy the test.dmp from d!MoracleMdial to d!MoracleMorcl ($his is the e7port file)
Import
%et "3AC)4/%IDI"3C)
C!MDocuments and %ettingsMasoodGimpdp system5anitsood directoryIorcl/dir
dumpfileItest.dmp remap/schemaIsystem!scott
Import! 3elease (C.+.C.(.C . -roduction on $hursday, (A #ay, +CCD (N!C+!6B
Copyright (c) +CC6, +CCB, "racle. All rights reser'ed.
Connected to! "racle Database (Cg 4nterprise 4dition 3elease (C.+.C.(.C U -roduction ,ith the
-artitioning, ")A- and Data #ining options
#aster table J%<%$4#J.J%<%/I#-"3$/90))/C(J successfully loaded5unloaded
%tarting J%<%$4#J.J%<%/I#-"3$/90))/C(J! system5KKKKKKKK directoryIorcl/dir
dumpfileItest.dmp remap/schemaIsystem!scott
-rocessing object type $AB)4/42-"3$5$AB)45$AB)4
Rob J%<%$4#J.J%<%/I#-"3$/90))/C(J successfully completed at (N!C+!6A
1ow connect to orcl database as scott user
%?)G show user
0%43 is J%C"$$J
%?)G %4)4C$ C"01$(K) 93"# dial@
C"01$(K)
..........
HN6NH

You might also like