SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
PREPARED BY RAVI KUMAR LANKE Page 1
ORACLE BACKUP
Backing up an Oracle database can be done in many different ways and is quite difficult to get a
grasp on compared to other mainstream databases. Backup is best done through RMAN whether
you access RMAN from a command line interface (CLI) or from within Oracle Enterprise
Manager (GUI)
Oracle versions tested here:
1. Oracle 11gR2 on Windows/Linux/Solaris
2. Oracle Express 10g XE on Windows/Linux
Configure Oracle backup environment - using Enterprise
Manager (GUI)
Before you start taking backup, you should configure your backup environment. Here is how to
configure the Oracle backup environment using Enterprise Manager.
PREPARED BY RAVI KUMAR LANKE Page 2
Log on to Enterprise Manager as 'sys as sysdba'.
PREPARED BY RAVI KUMAR LANKE Page 3
Go to "Availability tab > Backup/Recovery > Backup Settings".
PREPARED BY RAVI KUMAR LANKE Page 4
PREPARED BY RAVI KUMAR LANKE Page 5
PREPARED BY RAVI KUMAR LANKE Page 6
Under the "Device" tab set :
1. Disk backup location. If you change the from default (the fast recovery area), you need to
point to an existing directory
2. Choose backup type :
o Backup Set (default) : will create backup files in a format that only RMAN
understands.
o Image Copy : will create backup files corresponding to the files that make up the
database, that is : 5 data files (prefixed DATA_), a copy of the SPFILE, a copy of
the Control file and if in ARCHIVELOG mode also a number of redo files
(prefixed ARCH_).
3. Enter host credentials (the user who installed Oracle).
4. press the 'Test Disk Backup' button to confirm it works.
3.
4. If you are on Solaris you may get Connection to host as user oracle failed:
ERROR: NMO not setuid-root (Unix-only). If you get that error then:
1. Open a shell as root
2. #> su oracle : switch to user oracle.
3. $> emctl stop dbconsole : stop the dbconsole.
4. $> exit : back to root user.
5. #> ORACLE_OWNER=oracle : initialize the ORACLE_OWNER
variable.
6. #> export ORACLE_OWNER : add the ORACLE_OWNER to the root
environment.
7. #> cd $ORACLE_HOME :
8. #> ./root.sh : execute the root.sh script and answer yes to all prompts.
9. #> su oracle : switch to user oracle.
10. $> emctl start dbconsole : start the dbconsole.
11. Try the "Test Disk Backup" button again.
5. Press the OK button to save the settings
4. Under the Backup Set tab there is no settings necessary to set
5. Under the Policy tab it is possible to tune the backup, however I feel the backup result
files become less independent and I choose to skip optimize options. The Retention
Policy I like to choose the default "Retain at least the specified number of full backups
for each datafile" with a value of 1. This is because it then gives meaning to let a 3. party
backup program copy the backup result to a remote backup store and handle the retention
period outside of Enterprise Manager control.
You are now ready to do backup.
PREPARED BY RAVI KUMAR LANKE Page 7
Backup Oracle - using RMAN (CLI) -
Windows/Linux/Solaris
The RMAN backup procedure depends on whether your Oracle database is in ARCHIVELOG or
NOARCHIVELOG mode, therefore start by checking the log_mode :
1. Open a command prompt
2. shell> sqlplus / as sysdba : start SQL*Plus and log in as sysdba
3. sql> select log_name from v$database; : will display whether you are in ARCHIVELOG or
NOARCHIVELOG mode
4. sql> exit
Now that you know your log_mode, ARCHIVELOG or NOARCHIVELOG, you can choose the
appropiate step-by-step procedure :
 If in ARCHIVELOG mode :
The backup is quite simple because you can take the backup while the database is open (online
backup)
1. Open a shell.
2. shell> rman target / : logon to RMAN using host credentials.
3. rman> show all; : shows the environment configuration (that can be setup using the
"Enterprise Manager > Availability tab > Backup/Recovery > Backup Settings")
4. rman> backup database plus archivelog; : start backup and include the archivelog since
they are needed to secure a consistent restore
5. rman> exit : you are finished.
PREPARED BY RAVI KUMAR LANKE Page 8
 If in NOARCHIVELOG mode :
The backup is less simple because you need to be sure the database is in a consistent state and
then mount the database without opening it (offline backup)
1. Open a shell.
2. shell> rman target / : logon to RMAN using host credentials.
3. rman> shutdown immediate; : shutdown and rollback pending transactions (without the
immediate keyword, the shutdown will wait for all pending transactions to finish)
4. rman> startup mount; : startup and mount the database but without opening it
(datafiles location will be known but not loaded).
5. rman> show all; : shows the environment configuration you did under Configure Oracle
backup environment.
6. Depending on configured Backup type : ("Enterprise Manager > Availability tab >
Backup/Recovery > Backup Settings")
 rman> backup database; : if Backup type = Backup Set (default).
 rman> backup as copy database; : if Backup type = Image Copy.
7. rman> alter database open; : open the database (the datafiles will be loaded and the
database therefore online).
8. rman> exit : you are finished.
The database is now backed up and the resulting backup files located in the Disk backup location
(specified then configuring the Oracle backup environment).
The resulting backup files could then be copied to some remote storage location for increased
security (eg. if the Disk backup location is on the same harddisk as the live datafiles and that
harddisk fails, then the backup is not going to help)
PREPARED BY RAVI KUMAR LANKE Page 9
Backup Oracle - using Enterprise Manager (GUI) -
Windows/Linux/Solaris
Note that Enterprise Manager is only a GUI on top of RMAN.
Log on to Enterprise Manager as 'sys as sysdba'
PREPARED BY RAVI KUMAR LANKE Page 10
Go to "Availability tab > Backup/Recovery > Schedule Backup
PREPARED BY RAVI KUMAR LANKE Page 11
On the "Schedule Backup" page you can choose between "Schedule Oracle Suggested Backup"
and "Schedule Customized Backup". The main difference between the two is that "Schedule
customized backup" allows you to :
 Choose between an immediate non-scheduled backup or a scheduled backup.
 Override default backup environment settings
PREPARED BY RAVI KUMAR LANKE Page 12
Since Oracle suggested backup don't offer any significant convenience, press the "Schedule Customized
Backup" button.
On the "Options" page accept default "Full Backup" and press the "Next" button
PREPARED BY RAVI KUMAR LANKE Page 13
On the "Settings" page the defaults will depend on your Oracle environment configuration, however in
case of an immediate single backup you maybe want to change the settings in which case you press the
"Override default settings" button. Then you are happy, press the "Next" button
PREPARED BY RAVI KUMAR LANKE Page 14
On the "Schedule" page, the job needs a name, a description and a schedule (here One Time
Immediately). Press the "Next" button.
Press the "Submit Job" button
You now have a backup in your designated backup folder. Best to copy that backup to a remote storage,
so that if your harddrive fails, you still have a copy of the backup files
PREPARED BY RAVI KUMAR LANKE Page 15
Backup Oracle - using Flashback - Windows/Linux/Solaris
Flashback is not available in all editions.
In editions containing Flashback, Flashback is disabled by default. However, if you have
Flashback and you have the disk space, then Flashback is important to enable because it is a
more efficient alternative to DBPITR (DataBase Point-In-Time Recovery), that is: then a
database needs to roll back because of unwanted changes eg. a user have overwritten data or an
administrator have dropped a table.
As with DBPITR, Flashback cannot be used in case of media errors, eg. data file corruption.
If Flashback is enabled, the database will continously write data file blocks to the flashback logs
as well as create, delete and resize them. Flashback logs are not archived and cannot be backed
up to disk.
First check if flashback is already turned on :
1. Open a shell.
2. #> su oracle : ONLY Solaris : if you have opened a shell as root, you may not be able to use
SQL*Plus, so better switch user to oracle.
3. shell> sqlplus / as sysdba : logon to SQL*Plus as sydba.
4. sql> select flashback_on from v$database; : you will get either YES or NO.
If Flashback is not enabled, you can enable Flashback using either SQL*Plus or Enterprise Manager :
PREPARED BY RAVI KUMAR LANKE Page 16
 Enable Flashback using SQL*Plus (CLI) :
1. Open a shell.
2. shell> sqlplus / as sysdba : logon to SQL*Plus as sysdba.
3. sql> alter database set db_flashback_retention_target=4320; : setting flashback
retention to 3 days (default is 1440 minutes = 1 day). If fast recovery area disk constraint
allows it, this will make it possible to look 3 days into the past
4. sql> alter database flashback on; : enable flashback. If you get error ORA-38703: Media
recovery is not enabled, then you are most likely in NOARCHIVELOG mode.
 sql> select log_mode from v$database; : confirm your log mode. If you are in
NOARCHIVELOG and you want to change to ARCHIVELOG so that you can enable
Flashback :
1. sql> shutdown immediate; :
2. sql> startup mount; :
3. sql> alter database archivelog; :
4. sql> alter database open; :
5. sql> alter database flashback on; : this time you should be able to
enable flashback.
PREPARED BY RAVI KUMAR LANKE Page 17
Enable Flashback using Enterprise Manager (GUI) :
Log on to Enterprise Manager as 'sys as sysdba'.
PREPARED BY RAVI KUMAR LANKE Page 18
On the Availability tab click on the "Recovery Settings" link
PREPARED BY RAVI KUMAR LANKE Page 19
On the Recovery Settings page :
PREPARED BY RAVI KUMAR LANKE Page 20
1. Be sure ARCHIVELOG mode is enabled - it is not possible to enable Flashback in
NOARCHIVELOG mode.
2. "Flash Recovery Area Size" is the maximum space allocated for Flashback logs, therefor
if set too low, it will cap your Flashback Retention Time. (The size of the flashback log is
approximately the same as the size of the redo log files, so if the flashback retention is 3
days, then the size of the flashback logs will be 3 times that of the redo logs).
3. Check the "Enable Flashback Database", this it what we came here for.
4. "Flashback Retention Time" is the time you will be able to roll your database back. If set
to default 24 hours and you found out that a user overwrote data 25 hours ago, you will
not be able to use Flashback to get the overwritten data back.
 Disable Flashback using SQL*Plus (CLI) :
PREPARED BY RAVI KUMAR LANKE Page 21
(just here for completness)
1. Open a shell.
2. shell> sqlplus / as sysdba : logon to SQL*Plus as sysdba.
3. sql> alter database flashback off; : disable Flashback.
Flashback should now be enabled
Backup Oracle - using Export - Windows/Linux/solaris
Oracles Export (exp) & Import (imp) utilities are popular for backup of Oracle databases smaller
than say 50 GB (which is bigger than most databases). The reason they are so popular is because
they are both easy and versatile.
Oracles Export & Import utilities are used for the following tasks :
 Database backup - what we will do here
 Reducing fragmentation in the database.
 Move data from one owner to another.
 Move data from one version to another, eg. from version 9i to 11g.
 Moving the database from one operation system to another, eg. from Solaris to Windows.
Oracles Export & Import utilities are called exp & imp respectively, however from version 10,
Oracle introduced the DataPump utilities called expdp & impdp respectively. The DataPump
utilities should be superiour eg. faster and with support for network. The old exp & imp utilities
can still be used with Oracle 11gR2.
The DataPump utilities, expdp & impdp, works right away, however the old export/import
utilities, exp & imp, needs to be prepared by runnning the catexp.sql script :
1. Open a shell
2. shell> sqlplus / as sysdba : logon to SQL*Plus as sys as sysdba using host credentials
3. Execute the catexp.sql script :
o Windows : sql> @?rdbmsadmincatexp.sql : @ executes a script and ? points to
%ORACLE_HOME%.
o Solaris/Linux : sql> @?/rdbms/admin/catexp.sql : @ executes a script and ?
points to $ORACLE_HOME.
The exp utility can be used in 3 different modes : (from the shell)
PREPARED BY RAVI KUMAR LANKE Page 22
Interactive prompt : (holding your hand)
shell> exp : start the interactive prompt
PREPARED BY RAVI KUMAR LANKE Page 23
ogin. Here i use the same user as I want to export, however you can also use sys as sysdba
PREPARED BY RAVI KUMAR LANKE Page 24
specify the dump file location
PREPARED BY RAVI KUMAR LANKE Page 25
specify how to choose objects - here I want to export all objects for specific users
PREPARED BY RAVI KUMAR LANKE Page 26
PREPARED BY RAVI KUMAR LANKE Page 27
I am not sure what it means if you choose no, maybe all objects will be free of permissions
PREPARED BY RAVI KUMAR LANKE Page 28
yes, I want to export the data, however if I chose no I would get only the table structures
PREPARED BY RAVI KUMAR LANKE Page 29
yes just compress it
PREPARED BY RAVI KUMAR LANKE Page 30
choose the users for which I want to export objects, here just one user : rasmus
PREPARED BY RAVI KUMAR LANKE Page 31
the rasmus user have only one table with only 1 row
PREPARED BY RAVI KUMAR LANKE Page 32
PREPARED BY RAVI KUMAR LANKE Page 33
that went well.
PREPARED BY RAVI KUMAR LANKE Page 34
PREPARED BY RAVI KUMAR LANKE Page 35
 Standard command line : (fast dump on-the-fly)
o shell> exp scott/tiger file=scott.dmp : fast dumping all objects belonging to scott
(note that scott/tiger is the credentials used to login to the exp utility - it is just
default that you will then export the scott objects if nothing else specified)
o shell> exp scott/tiger file=scott.dmp log=scott.log : fast dumping all objects
belonging to scott and also a log file to see how the export went
o shell> exp scott/tiger file=scott.dmp log=scott.log tables=(tbl1,tbl2) : dumping
only the tables tbl1 & tbl2 (these tables must belong to scott) and a log file.
o shell> exp scott/tiger file=scott.dmp log=scott.log tables=(tbl1,tbl2) rows=no :
dumping only the structures (not the data) of tables tbl1 & tbl2 and a log file.
 Command line with parameter file : (if you need many parameters and you need to do
it often)
o no examples
PREPARED BY RAVI KUMAR LANKE Page 36
Appendix : SQL*Plus & RMAN : logon & management
commands
 Logon to SQL*Plus (no normal logon for user sys - either use as sysdba or as sysoper)
o shell> sqlplus / as sysdba : logon to SQL*Plus as sys as sysdba using host
credentials.
o shell> sqlplus sys/SysPassword as sysdba : logon to SQL*Plus as sys as sysdba
using sys password.
o shell> sqlplus scott/tiger : logon to SQL*Plus as scott who have the password
tiger.
 Logon to RMAN :
o shell> rman target / : logon to RMAN using host credentials.
o shell> rman : start the RMAN shell to logon from within RMAN :
 rman> connect target sys@orcl : format user@dbname.
 rman> connect target sys@ipadress/orcl : format user@ipaddress/dbname.
 rman> connect target sys@localhost/orcl) : format user@host/dbname.
 SQL*Plus management commands (most will require that you are logged on as sysdba)
o Managing database :
 sql> shutdown : database will wait for all pending transactions to commit,
then close, then dismount, then shutdown.
 sql> shutdown immediate : instead of waiting to commit all pending
transactions, Oracle will roll them all back - fast shutdown.
 sql> startup nomount : will start the database instance but not mount it.
Then issuing the startup command, Oracle will read the initalization
parameter file (init.ora or spfile) to get database configuration eg. size of
all memory areas which will then be allocated and all background
processes will be started and together these processes and allocated
memory is called an Oracle instance and that instance is now started.
 sql> startup mount : will start and then mount the database but not open it.
In the mount stage, the control file is read to locate the datafiles but
without opening them (without making access possible) - the instance is
now mounted. Obviously this is the right stage in which to take backup
since the datafile locations are now known and most likely consistent
(except for online backup that qua log files do not need consistent
datafiles).
 sql> startup : will start, mount and open the database. An open database is
also called an online database and makes it possible to access the datafiles
through Oracle eg. using sql (Stages in starting an Oracle database).
 sql> alter database mount; : change a nomounted to mounted.
 sql> alter database open; : change a mounted not opened to opened.
 sql> alter database open resetlogs; : change a mounted not opened to
opened and starts a new incarnation.
 sql> select name from v$database; : find the name of your database.
PREPARED BY RAVI KUMAR LANKE Page 37
 sql> select log_mode from v$database; : find out if your database is in
ARCHIVELOG or NOARCHIVELOG mode.
 sql> select open_mode from v$database; : show access, eg. OPEN
WRITE (gives error ORA-01034: ORACLE not available if the instance is
not started).
 sql> show parameters CONTROL_FILES; : find the path to your control
files.
 sql> select * from v$database_incarnation; : list all incarnations, however
RMAN creates a more nice list :
rman> list incarnation;
 sql> select value$ from sys.props$ where name =
'NLS_CHARACTERSET'; : shows the database ordinary characterset.
 sql> select * from nls_database_parameters; : shows additional language
information. NSL_CHARACTERSET is ordinary and
NLS__NCHAR_CHARACTERSET is national characterset.
 sql> alter database character set WE8MSWIN1252; : changes the
characterset to WE8MSWIN1252 - note if the new character is not a
superset of the old, you will get ora-12712: new character set must be a
superset of old character set.
(Official Character set Migration should be consulted).
o Managing users :
 sql> select * from all_users; : fast list of all users.
 sql> select username, user_id, account_status from dba_users order by
username; : dba_users contains quite a lot more info than all_users.
 sql> select user#, name from sys.user$; : more users and more info.
 sql> create user rasmus identified by myPassword; : creating a user called
rasmus with the password myPassword.
 sql> alter user rasmus identified by newPassword; : change the password
for rasmus from myPassword to newPassword.
 sql> grant connect to rasmus; : granting rasmus connect privilege.
 sql> create tablespace tsrasmus datafile 'C:apporadataorcltsrasmus.dbf'
size 20M;create a tablespace with a 20 MB datafile.
 sql> alter user rasmus default tablespace tsrasmus quota unlimited on
tsrasmus; : specify that rasmus default should store objects in tsrasmus
instead of in the user tablespace.
 sql> alter user rasmus account unlock; : unlock the rasmus user account.
 sql> drop user rasmus cascade; : deleting the rasmus user. Specify cascade
to also delete all objects belonging to rasmus.
o Managing tables :
 sql> desc dba_users; : show the structure of the dba_users table.
 sql> select * from cat; : shows all tables belonging to current user.
 sql> select table_name from dictionary; have less tables but more
information.
 sql> select table_name from dba_tables; : shows all tables in the database
regardless of user and having a lot of info.
PREPARED BY RAVI KUMAR LANKE Page 38
 sql> select owner, table_name, tablespace_name from dba_tables where
owner = 'RASMUS'; : show all tables and there they are stored for the
rasmus user.
 sql> create table employees (firstname varchar2(100), age number); :
creating a table called employees.
 sql> drop table employees; : deleting the employees table.
o Managing SQL*Plus :
 sql> show all; : show all SQL*Plus settings.
 sql> help topics; : list all topics that there are help for.
 sql> @myscript.sql : executes myscript.sql which must be in the current
directory
 sql> @C:appproductdbhome_1rdbmsadmincatexp.sql : if the script is
not in current directory, then specify the full path.
 sql> @?rdbmsadmincatexp.sql : ? is a shorthand for
%ORACLE_HOME% (windows) or $ORACLE_HOME (solaris/linux).
 sql> ed myscript.sql; : starts an associated text editor and opens op
myscript.sql from current directory.
 sql> define; : will show all defined variables.
 sql> define rasmus=programmer : declare a new variable called rasmus
and initializes it with the value programmer.
 sql> undefine rasmus; :
Appendix : Oracle backup related concepts :
 RMAN : Recovery MANager command utility. Preferred to to backup & restore Oracle
databases as it provides an OS independent interface as well as removes OS dependencies
in the backup files
 RMAN Repository : records of database files and backups for each database on which
RMAN performs operations. These meta data are stored in the control file of the target
database, therefore you should always backup the control file.
 Enterprise Manager : (normally abbreviated EM or OEM) : Web application to manage
Oracle. It is possible to perform and schedule backups using EM (EM backup will use
RMAN underneath and as such EM is a GUI frontend to RMAN)
 Fast Recovery Area : (earlier named flash recovery area). A directory to store recovery
related files such as control file, online redo log copies, archived redo log files, flashback
logs and RMAN backups. Oracle & RMAN automatically manage the files in this
directory, eg. automatically delete files that are no longer needed.
 Oracle Flashback : Oracle Flashback is built-in to some but not all Oracle database
editions and enables you to recover data from unwanted database changes without
restoring files from backup or performing media recovery - this feature relies on undo
data. Flashback must be turned on though and can be turned on for individual tables and a
retention period must be specified, this will create a flashback data archive.
 SCN : System Change Number : Everytime a transaction is committed, Oracle records a
new SCN. Then Oracle starts up, Oracle check SCN in all datafile headers and in the
PREPARED BY RAVI KUMAR LANKE Page 39
control file and if they are all the same then the database is consistent. If they are not the
same, the database is in need of recovery.
 Offline Backup : (sometimes called cold backup) backups that run when the database is
in the mounted but not open state. Oracle in NOARCHIVELOG log_mode must do
offline backup
 Online Backup : (sometimes called hot backup) backups that run when the database is in
open state. Oracle in ARCHIVELOG log_mode can do online backup
 log_mode : Oracle can be in either ARCHIVELOG or NOARCHIVELOG log_mode.
The ARCHIVELOG have 2 advantages
o Oracle can do Online Backup
o Oracle can restore ALL committed data to the point of failure as opposed to
NOARCHIVELOG log_mode there Oracle restore will loose all data committed
since the last backup
 Physical >< Logical Backup : Physical backup refers to the files making up the database
while Logical backup referes to data, tables etc. Oracle backup is mostly physical backup
 Backing up a database : means to make copies of the data files, control file and if in
ARCHIVELOG mode then also copies of archived redo log files
 Restoring a database : means copying the physical files that comprise the database from
a backup medium (disk or tape) to their original or to new locations
 Database recovery : is the process of updating database files restored from a backup
with the changes made to the database after the backup (typically using the redo log files)
 Media Recovery : most often used to recover from media failure, eg. loss of a file or disk
or a user error eg. deletion of the contents of a table. Media recovery requires a control
file, data filees (typically restored from backup) and online and archived redo log files
(that contains the changes since the time the data files were backed up.
 Control file : contains among other things names & locations of data files and online &
archive log records and backup records. Also without the control file, the database cannot
be mounted and therefore recovery cannot be performed - you need to backup the control
file.
 SPFILE : Server Parameter file : A binary parameter file that Oracle is using upon
startup (alternatively a text based PFILE can be used). The name of the SPFILE may be
spfileSID.ora, where SID is the database name (PFILE nomenclature is initSID.ora). If no
parameter file can be found, Oracle cannot start up.
 Table spaces : Logical storage unit (logical because there is no file representation on the
file system) used to organizing objects. A table space have at least one data file and a data
file can only belong to one table space. Tables, indexes etc. belongs to a tablespace.
Table spaces can be created, but then a database is created it will be created with 5
default table spaces : system, sysaux, temp, undotbs1 & users.
 Data files : Physical representation of the table spaces, that is: data files physically holds
the data.
 Schema : Collection of objects owned by a user of the same name. Eg if the user is
Rasmus, then all objects like tables, views, indexes etc. owned by Rasmus is collected in
a Schema named Rasmus.
 Management Repository Encryption key : If Enterprise Manager data is encrypted
(Management Repository has been placed in secure mode), then this key MUST be
PREPARED BY RAVI KUMAR LANKE Page 40
backed up as the encrypted data will become unusable if this file is lost. Location is :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1/localhost_orcl/sysman/config/e
mkey.ora.
Appendix : default Oracle file locations
Below USER_NAME is the user that installed Oracle.
 Fast Recovery Area (called flash recovery area on Oracle Express XE 10g)
o Oracle 11gR2 on Windows :
C:appUSER_NAMEflash_recovery_areaDB_NAME
o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/flash_recovery_area
o Oracle Express XE 10g on Windows :
C:oraclexeapporacleflash_recovery_areaXE
o Oracle Express XE 10g on Linux :
/usr/lib/oracle/xe/app/oracle/flash_recovery_area/
 Data files :
o Oracle 11gR2 on Windows : C:appUSER_NAMEoradataDB_NAME
o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/oradata/??
 Installation files :
o Oracle 11gR2 on Solaris :
/export/home/oracle/app/oraInventory/PRODUCT_NAME
 Control file :
o Oracle 11gR2 on Windows : C:appUSER_NAMEoradataDB_NAME (same
place as the data files)
 SPFILE :
o Oracle 11gR2 on Solaris :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl.ora
 listener.ora & tnsnames.ora :
o Oracle 11gR2 on Solaris :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin
 oratab : (defines home folders for each database instance in the format SID:FOLDER)
o Oracle 11gR2 on Solaris : /var/opt/oracle/oratab
o Oracle 11gR2 on Linux : /var/oratab
 Environment Variables :
o Oracle 11gR2 on Solaris $ORACLE_BASE : /export/home/oracle/app/oracle
o Oracle 11gR2 on Solaris $ORACLE_HOME :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1
o Oracle 11gR2 on Solaris $ORACLE_OWNER : oracle
o Oracle 11gR2 on Solaris $ORACLE_SID : orcl
PREPARED BY RAVI KUMAR LANKE Page 41
Appendix : Common errors & Solutions
1. c:> emctl dbconsole status : errors EM Configuration issue.
c:appUSERNAMEproduct11.2.0dbhome_1/HOSTNAME_DBNAME not found
2. $> emctl dbconsole status : errors EM Configuration issue.
/export/home/app/oracle/product/aa.2.0/dbhome_1/HOSTNAME_DBNAME not found
3. $> emctl dbconsole start : exactly the same error as 2.
4. $> emctl start dbconsole : errors OC4J Configuration issue.
.../oc4j/j2ee/OC4J_DBConsole_HOSTNAME_DBNAME not found
Reason : If you have one of the above errors, 1, 2, 3 or 4, you have most likely not set the
$ORACLE_HOSTNAME environment variable. The problem is that the Oracle installer will use
localhost for HOSTNAME at least then installing a desktop class system. However, then services
start, Oracle will match hostname with $ORACLE_HOSTNAME and if
$ORACLE_HOSTNAME is empty then substitute with the system hostname, which likely is
different from localhost.
Example : If your hostname is Solaris10 and your database name is orcl, then emctl will search
for ../oc4j/j2ee/OC4J_DBConsole_Solaris10_orcl, but the installer created
../oc4j/j2ee/OC4J_DBConsole_localhost_orcl.
Solution : There are different possible solutions of which by far the easiest is to set the
$ORACLE_HOSTNAME to localhost :
1. On Windows
1. Open a shell.
2. c:> set ORACLE_HOSTNAME=localhost : declare, initialize and add the
variable to your environment
3. c:> echo %ORACLE_HOSTNAME% : confirm the variable - you should get
localhost.
2. On Solaris
1. Open a shell.
2. #> ORACLE_HOSTNAME=localhost : declare & initialize the variable.
3. #> export ORACLE_HOSTNAME : add the variable to your environment.
4. #> echo $ORACLE_HOSTNAME : confirm the variable - you should get
localhost.
PREPARED BY RAVI KUMAR LANKE Page 42
To persist $ORACLE_HOSTNAME on system boot (Solaris), please see here (step 9).
5. c:> emctl dbconsole status : errors Environment variable ORACLE_UNQNAME not
defined. Please set ORACLE_UNQNAME to database unique name.
Solution : Set the ORACLE_UNQNAME to the value of your database name :
 On Windows
1. Open a shell.
2. c:> set ORACLE_UNQNAME=orcl : declare, initialize and add the variable to
your environment
3. c:> echo %ORACLE_UNQNAME% : confirm the variable - you should get orcl.
 On Solaris
1. Open a shell.
2. #> ORACLE_UNQNAME=localhost : declare & initialize the variable.
3. #> export ORACLE_UNQNAME : add the variable to your environment.
4. #> echo $ORACLE_UNQNAME : confirm the variable - you should get orcl.
Enterprise Manager cannot connect.
PREPARED BY RAVI KUMAR LANKE Page 43
Solution : This solution worked for me. If it does not work for you, you can read more here
1. On Windows
1. Open a shell.
2. c:> set ORACLE_SID=orcl : declare, initialize and add the variable to your
environment
3. c:> emca -deconfig dbconsole db : you will be prompted for your database name.
4. c:> emca -config dbconsole db : you will be prompted for dbname, several
passwords, ORACLE_HOME and Listener port number (default 1521).
5. Refresh Enterprise Manager in your browser.
PREPARED BY RAVI KUMAR LANKE Page 44
sql> alter database open; : errors ORA-38760: This database instance failed to turn on flashback
database
Solution : Turning flashback off and then on should solve the problem, however any guaranteed
restore point need to dropped.
1. You should already be in your SQL*Plus shell.
2. Be sure your database is started and in mounted stage :
1. sql> shutdown immediate;
2. sql> startup mount;
3. Check for quaranteed restore points and delete them if found :
1. sql> select name, scn, guarantee_flashback_database, database_incarnation# from
v$restore_point; : list your restore points.
2. If you found any then drop them
Example: sql> drop restore point RESTORE_POINT_NAME;.
4. sql> alter database flashback off; : turn off flashback.
5. sql> alter database flashback on; : turn on flashback.
6. sql> alter database open; : this time you should succeed.
Enterprise Manager import/export give error ORA-20446: The owner of the job is not registered ORA-
06512: at "SYSMAN.MGMT_JOBS", line 168 ORA-06512: at "SYSMAN.MGMT_JOBS", line 86 ORA-06512:
at line 1.
PREPARED BY RAVI KUMAR LANKE Page 45
Reason : This is likely a bug in Oracle 11g
Solution :
1. On Windows/Solaris/Linux
1. Open a shell.
2. shell> sqlplus sysman/SysmanPassword : logon to SQL*Plus as SYSMAN.
3. sql> execute MGMT_USER.MAKE_EM_USER(‘USERID’); : USERID is the
user that you use to login to Enterprise Manager then doing import/export.
4. Try running import/export again.

Contenu connexe

Tendances

Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database BackupHandy_Backup
 
Pluggable database 3
Pluggable database 3Pluggable database 3
Pluggable database 3Osama Mustafa
 
12c (12.1) Database installation on Solaris 11(11.2)
12c (12.1) Database  installation on Solaris 11(11.2)12c (12.1) Database  installation on Solaris 11(11.2)
12c (12.1) Database installation on Solaris 11(11.2)K Kumar Guduru
 
Oracle 12cR2 RAC Database Software Installation and Create Database
Oracle 12cR2 RAC Database Software Installation and Create DatabaseOracle 12cR2 RAC Database Software Installation and Create Database
Oracle 12cR2 RAC Database Software Installation and Create DatabaseMonowar Mukul
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12cuzzal basak
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupArun Sharma
 
Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2Biju Thomas
 
Oracle Database 11g Product Family
Oracle Database 11g Product FamilyOracle Database 11g Product Family
Oracle Database 11g Product FamilyN/A
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11guzzal basak
 
Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c Osama Mustafa
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage enginesVasudeva Rao
 
Oracle dba interview question
Oracle dba interview questionOracle dba interview question
Oracle dba interview questionAmarendra Sharma
 

Tendances (20)

141 Pdfsam
141 Pdfsam141 Pdfsam
141 Pdfsam
 
41 Pdfsam
41 Pdfsam41 Pdfsam
41 Pdfsam
 
Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database Backup
 
Pluggable database 3
Pluggable database 3Pluggable database 3
Pluggable database 3
 
12c (12.1) Database installation on Solaris 11(11.2)
12c (12.1) Database  installation on Solaris 11(11.2)12c (12.1) Database  installation on Solaris 11(11.2)
12c (12.1) Database installation on Solaris 11(11.2)
 
Oracle 12cR2 RAC Database Software Installation and Create Database
Oracle 12cR2 RAC Database Software Installation and Create DatabaseOracle 12cR2 RAC Database Software Installation and Create Database
Oracle 12cR2 RAC Database Software Installation and Create Database
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
141 Rac
141 Rac141 Rac
141 Rac
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard Setup
 
121 Pdfsam
121 Pdfsam121 Pdfsam
121 Pdfsam
 
Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2
 
241 Pdfsam
241 Pdfsam241 Pdfsam
241 Pdfsam
 
Oracle Database 11g Product Family
Oracle Database 11g Product FamilyOracle Database 11g Product Family
Oracle Database 11g Product Family
 
Oracle11g notes
Oracle11g notesOracle11g notes
Oracle11g notes
 
Oracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11gOracle business intelligence enterprise edition 11g
Oracle business intelligence enterprise edition 11g
 
8i standby
8i standby8i standby
8i standby
 
261 Pdfsam
261 Pdfsam261 Pdfsam
261 Pdfsam
 
Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage engines
 
Oracle dba interview question
Oracle dba interview questionOracle dba interview question
Oracle dba interview question
 

En vedette

La gestion de asociaciones y fundaciones: Javier Corral
La gestion de asociaciones y fundaciones: Javier CorralLa gestion de asociaciones y fundaciones: Javier Corral
La gestion de asociaciones y fundaciones: Javier Corralekonomistak
 
Poems In Power Point For Children
Poems In Power Point For ChildrenPoems In Power Point For Children
Poems In Power Point For Childrenguestea9dcdd
 
Erin breelaceyhannahmicateam resistance52marx
Erin breelaceyhannahmicateam resistance52marxErin breelaceyhannahmicateam resistance52marx
Erin breelaceyhannahmicateam resistance52marxhmoulds
 
5 SEO Mistakes that are Costing you Millions (Travel Edition)
5 SEO Mistakes that are Costing you Millions (Travel Edition)5 SEO Mistakes that are Costing you Millions (Travel Edition)
5 SEO Mistakes that are Costing you Millions (Travel Edition)Powered by Search
 
Integrating technology into the classroom (introductory level
Integrating technology into the classroom (introductory levelIntegrating technology into the classroom (introductory level
Integrating technology into the classroom (introductory levelStephen Hernon
 
Projectmanagement
ProjectmanagementProjectmanagement
Projectmanagementdjinny020
 
Unified Brand Overview
Unified Brand OverviewUnified Brand Overview
Unified Brand Overviewjustinbalogh
 
Potato print accessories tutorial
Potato print accessories tutorialPotato print accessories tutorial
Potato print accessories tutorialSam Gillespie
 
夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用
夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用
夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用Developers Summit
 

En vedette (20)

La gestion de asociaciones y fundaciones: Javier Corral
La gestion de asociaciones y fundaciones: Javier CorralLa gestion de asociaciones y fundaciones: Javier Corral
La gestion de asociaciones y fundaciones: Javier Corral
 
Poems In Power Point For Children
Poems In Power Point For ChildrenPoems In Power Point For Children
Poems In Power Point For Children
 
ara TELE-satellite 0909
ara TELE-satellite 0909ara TELE-satellite 0909
ara TELE-satellite 0909
 
Erin breelaceyhannahmicateam resistance52marx
Erin breelaceyhannahmicateam resistance52marxErin breelaceyhannahmicateam resistance52marx
Erin breelaceyhannahmicateam resistance52marx
 
Dizipia
DizipiaDizipia
Dizipia
 
Cardsplitter
CardsplitterCardsplitter
Cardsplitter
 
Dragonsat
DragonsatDragonsat
Dragonsat
 
5 SEO Mistakes that are Costing you Millions (Travel Edition)
5 SEO Mistakes that are Costing you Millions (Travel Edition)5 SEO Mistakes that are Costing you Millions (Travel Edition)
5 SEO Mistakes that are Costing you Millions (Travel Edition)
 
1.1a rasional pengembangan k2013
1.1a    rasional pengembangan k20131.1a    rasional pengembangan k2013
1.1a rasional pengembangan k2013
 
Sammeg
SammegSammeg
Sammeg
 
8dtek
8dtek8dtek
8dtek
 
Integrating technology into the classroom (introductory level
Integrating technology into the classroom (introductory levelIntegrating technology into the classroom (introductory level
Integrating technology into the classroom (introductory level
 
Installing vpn client
Installing vpn clientInstalling vpn client
Installing vpn client
 
Projectmanagement
ProjectmanagementProjectmanagement
Projectmanagement
 
Infosat
InfosatInfosat
Infosat
 
Gi
GiGi
Gi
 
Jiuzhou
JiuzhouJiuzhou
Jiuzhou
 
Unified Brand Overview
Unified Brand OverviewUnified Brand Overview
Unified Brand Overview
 
Potato print accessories tutorial
Potato print accessories tutorialPotato print accessories tutorial
Potato print accessories tutorial
 
夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用
夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用
夏サミ2013 Hadoopを使わない独自の分散処理環境の構築とその運用
 

Similaire à Oracle backup

10 Problems with your RMAN backup script
10 Problems with your RMAN backup script10 Problems with your RMAN backup script
10 Problems with your RMAN backup scriptYury Velikanov
 
RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)Gustavo Rene Antunez
 
MySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online RecoveryMySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online RecoveryKeith Hollman
 
Making Backups in Extreme Situations
Making Backups in Extreme SituationsMaking Backups in Extreme Situations
Making Backups in Extreme SituationsSveta Smirnova
 
Collaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mysteryCollaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mysteryNelson Calero
 
Collaborate 2012 - RMAN eliminate the mystery
Collaborate 2012 - RMAN eliminate the mysteryCollaborate 2012 - RMAN eliminate the mystery
Collaborate 2012 - RMAN eliminate the mysteryNelson Calero
 
Create manula and automaticly database
Create manula and automaticly databaseCreate manula and automaticly database
Create manula and automaticly databaseAnar Godjaev
 
How to create a non managed standby database
How to create a non managed  standby databaseHow to create a non managed  standby database
How to create a non managed standby databaseJorge Batista
 
Oracle Database Backup Cloud Service
Oracle Database Backup Cloud ServiceOracle Database Backup Cloud Service
Oracle Database Backup Cloud ServiceMarketingArrowECS_CZ
 
oracle upgradation
oracle upgradationoracle upgradation
oracle upgradationinfluxbob
 
10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaperYury Velikanov
 
8 i rman_love_it
8 i rman_love_it8 i rman_love_it
8 i rman_love_itAnil Pandey
 
Enable oracle database vault
Enable oracle database vaultEnable oracle database vault
Enable oracle database vaultOsama Mustafa
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in DataguardJason Arneil
 

Similaire à Oracle backup (20)

Les 12 fl_db
Les 12 fl_dbLes 12 fl_db
Les 12 fl_db
 
Les 02 config
Les 02 configLes 02 config
Les 02 config
 
Xpp c user_rec
Xpp c user_recXpp c user_rec
Xpp c user_rec
 
oracle dba
oracle dbaoracle dba
oracle dba
 
10 Problems with your RMAN backup script
10 Problems with your RMAN backup script10 Problems with your RMAN backup script
10 Problems with your RMAN backup script
 
RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)
 
MySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online RecoveryMySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online Recovery
 
Les 05 create_bu
Les 05 create_buLes 05 create_bu
Les 05 create_bu
 
Les 07 rman_rec
Les 07 rman_recLes 07 rman_rec
Les 07 rman_rec
 
Making Backups in Extreme Situations
Making Backups in Extreme SituationsMaking Backups in Extreme Situations
Making Backups in Extreme Situations
 
Collaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mysteryCollaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mystery
 
Collaborate 2012 - RMAN eliminate the mystery
Collaborate 2012 - RMAN eliminate the mysteryCollaborate 2012 - RMAN eliminate the mystery
Collaborate 2012 - RMAN eliminate the mystery
 
Create manula and automaticly database
Create manula and automaticly databaseCreate manula and automaticly database
Create manula and automaticly database
 
How to create a non managed standby database
How to create a non managed  standby databaseHow to create a non managed  standby database
How to create a non managed standby database
 
Oracle Database Backup Cloud Service
Oracle Database Backup Cloud ServiceOracle Database Backup Cloud Service
Oracle Database Backup Cloud Service
 
oracle upgradation
oracle upgradationoracle upgradation
oracle upgradation
 
10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper
 
8 i rman_love_it
8 i rman_love_it8 i rman_love_it
8 i rman_love_it
 
Enable oracle database vault
Enable oracle database vaultEnable oracle database vault
Enable oracle database vault
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in Dataguard
 

Plus de Ravi Kumar Lanke

Creating and configuring vnc sessions
Creating and configuring vnc sessionsCreating and configuring vnc sessions
Creating and configuring vnc sessionsRavi Kumar Lanke
 
Copying files between linux machines using scp and ssh without linux user pas...
Copying files between linux machines using scp and ssh without linux user pas...Copying files between linux machines using scp and ssh without linux user pas...
Copying files between linux machines using scp and ssh without linux user pas...Ravi Kumar Lanke
 
Exporting schema to dmp file and importing it into other oracle database
Exporting schema to dmp file and importing it into other oracle databaseExporting schema to dmp file and importing it into other oracle database
Exporting schema to dmp file and importing it into other oracle databaseRavi Kumar Lanke
 
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...Ravi Kumar Lanke
 
Installing solaris on virtual box and installing weblogic server
Installing solaris on virtual box and installing weblogic server Installing solaris on virtual box and installing weblogic server
Installing solaris on virtual box and installing weblogic server Ravi Kumar Lanke
 
Enabling remote desktop connection on windows 7 64 bit
Enabling remote desktop connection on windows 7 64 bitEnabling remote desktop connection on windows 7 64 bit
Enabling remote desktop connection on windows 7 64 bitRavi Kumar Lanke
 
Connecting to the remote database through sql developer without database clie...
Connecting to the remote database through sql developer without database clie...Connecting to the remote database through sql developer without database clie...
Connecting to the remote database through sql developer without database clie...Ravi Kumar Lanke
 
Setting home path class path and path for java on windows 7
Setting home path class path and path for java on windows 7Setting home path class path and path for java on windows 7
Setting home path class path and path for java on windows 7Ravi Kumar Lanke
 
How to find ip and mac address
How to find ip and mac addressHow to find ip and mac address
How to find ip and mac addressRavi Kumar Lanke
 
Step by step deployment of sampleappv406
Step by step deployment of  sampleappv406Step by step deployment of  sampleappv406
Step by step deployment of sampleappv406Ravi Kumar Lanke
 
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
Installing and configuring informatica 910 and dac 11 g on windows 64 bitInstalling and configuring informatica 910 and dac 11 g on windows 64 bit
Installing and configuring informatica 910 and dac 11 g on windows 64 bitRavi Kumar Lanke
 
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0Ravi Kumar Lanke
 
Installing my sql on windows
Installing my sql on windowsInstalling my sql on windows
Installing my sql on windowsRavi Kumar Lanke
 
How to prevent access to command prompt and registry editing tools and window...
How to prevent access to command prompt and registry editing tools and window...How to prevent access to command prompt and registry editing tools and window...
How to prevent access to command prompt and registry editing tools and window...Ravi Kumar Lanke
 
How to disable and enable task manager
How to disable and enable task managerHow to disable and enable task manager
How to disable and enable task managerRavi Kumar Lanke
 
Deploying an application into oracle endeca tools and frame works
Deploying an application into oracle endeca tools and frame worksDeploying an application into oracle endeca tools and frame works
Deploying an application into oracle endeca tools and frame worksRavi Kumar Lanke
 
Installing oracle endeca commerce
Installing oracle endeca commerceInstalling oracle endeca commerce
Installing oracle endeca commerceRavi Kumar Lanke
 
How to deploy rpd and catalog without enterprise manger
How to deploy rpd and catalog without enterprise mangerHow to deploy rpd and catalog without enterprise manger
How to deploy rpd and catalog without enterprise mangerRavi Kumar Lanke
 
How to change the obiee 11g browser title
How to change the obiee 11g browser titleHow to change the obiee 11g browser title
How to change the obiee 11g browser titleRavi Kumar Lanke
 
Creating new service name for oracle database
Creating new service name for oracle databaseCreating new service name for oracle database
Creating new service name for oracle databaseRavi Kumar Lanke
 

Plus de Ravi Kumar Lanke (20)

Creating and configuring vnc sessions
Creating and configuring vnc sessionsCreating and configuring vnc sessions
Creating and configuring vnc sessions
 
Copying files between linux machines using scp and ssh without linux user pas...
Copying files between linux machines using scp and ssh without linux user pas...Copying files between linux machines using scp and ssh without linux user pas...
Copying files between linux machines using scp and ssh without linux user pas...
 
Exporting schema to dmp file and importing it into other oracle database
Exporting schema to dmp file and importing it into other oracle databaseExporting schema to dmp file and importing it into other oracle database
Exporting schema to dmp file and importing it into other oracle database
 
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
 
Installing solaris on virtual box and installing weblogic server
Installing solaris on virtual box and installing weblogic server Installing solaris on virtual box and installing weblogic server
Installing solaris on virtual box and installing weblogic server
 
Enabling remote desktop connection on windows 7 64 bit
Enabling remote desktop connection on windows 7 64 bitEnabling remote desktop connection on windows 7 64 bit
Enabling remote desktop connection on windows 7 64 bit
 
Connecting to the remote database through sql developer without database clie...
Connecting to the remote database through sql developer without database clie...Connecting to the remote database through sql developer without database clie...
Connecting to the remote database through sql developer without database clie...
 
Setting home path class path and path for java on windows 7
Setting home path class path and path for java on windows 7Setting home path class path and path for java on windows 7
Setting home path class path and path for java on windows 7
 
How to find ip and mac address
How to find ip and mac addressHow to find ip and mac address
How to find ip and mac address
 
Step by step deployment of sampleappv406
Step by step deployment of  sampleappv406Step by step deployment of  sampleappv406
Step by step deployment of sampleappv406
 
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
Installing and configuring informatica 910 and dac 11 g on windows 64 bitInstalling and configuring informatica 910 and dac 11 g on windows 64 bit
Installing and configuring informatica 910 and dac 11 g on windows 64 bit
 
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
Installing bi applications 7.9.6.4 on obiee 11.1.1.7.0
 
Installing my sql on windows
Installing my sql on windowsInstalling my sql on windows
Installing my sql on windows
 
How to prevent access to command prompt and registry editing tools and window...
How to prevent access to command prompt and registry editing tools and window...How to prevent access to command prompt and registry editing tools and window...
How to prevent access to command prompt and registry editing tools and window...
 
How to disable and enable task manager
How to disable and enable task managerHow to disable and enable task manager
How to disable and enable task manager
 
Deploying an application into oracle endeca tools and frame works
Deploying an application into oracle endeca tools and frame worksDeploying an application into oracle endeca tools and frame works
Deploying an application into oracle endeca tools and frame works
 
Installing oracle endeca commerce
Installing oracle endeca commerceInstalling oracle endeca commerce
Installing oracle endeca commerce
 
How to deploy rpd and catalog without enterprise manger
How to deploy rpd and catalog without enterprise mangerHow to deploy rpd and catalog without enterprise manger
How to deploy rpd and catalog without enterprise manger
 
How to change the obiee 11g browser title
How to change the obiee 11g browser titleHow to change the obiee 11g browser title
How to change the obiee 11g browser title
 
Creating new service name for oracle database
Creating new service name for oracle databaseCreating new service name for oracle database
Creating new service name for oracle database
 

Dernier

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 

Dernier (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 

Oracle backup

  • 1. PREPARED BY RAVI KUMAR LANKE Page 1 ORACLE BACKUP Backing up an Oracle database can be done in many different ways and is quite difficult to get a grasp on compared to other mainstream databases. Backup is best done through RMAN whether you access RMAN from a command line interface (CLI) or from within Oracle Enterprise Manager (GUI) Oracle versions tested here: 1. Oracle 11gR2 on Windows/Linux/Solaris 2. Oracle Express 10g XE on Windows/Linux Configure Oracle backup environment - using Enterprise Manager (GUI) Before you start taking backup, you should configure your backup environment. Here is how to configure the Oracle backup environment using Enterprise Manager.
  • 2. PREPARED BY RAVI KUMAR LANKE Page 2 Log on to Enterprise Manager as 'sys as sysdba'.
  • 3. PREPARED BY RAVI KUMAR LANKE Page 3 Go to "Availability tab > Backup/Recovery > Backup Settings".
  • 4. PREPARED BY RAVI KUMAR LANKE Page 4
  • 5. PREPARED BY RAVI KUMAR LANKE Page 5
  • 6. PREPARED BY RAVI KUMAR LANKE Page 6 Under the "Device" tab set : 1. Disk backup location. If you change the from default (the fast recovery area), you need to point to an existing directory 2. Choose backup type : o Backup Set (default) : will create backup files in a format that only RMAN understands. o Image Copy : will create backup files corresponding to the files that make up the database, that is : 5 data files (prefixed DATA_), a copy of the SPFILE, a copy of the Control file and if in ARCHIVELOG mode also a number of redo files (prefixed ARCH_). 3. Enter host credentials (the user who installed Oracle). 4. press the 'Test Disk Backup' button to confirm it works. 3. 4. If you are on Solaris you may get Connection to host as user oracle failed: ERROR: NMO not setuid-root (Unix-only). If you get that error then: 1. Open a shell as root 2. #> su oracle : switch to user oracle. 3. $> emctl stop dbconsole : stop the dbconsole. 4. $> exit : back to root user. 5. #> ORACLE_OWNER=oracle : initialize the ORACLE_OWNER variable. 6. #> export ORACLE_OWNER : add the ORACLE_OWNER to the root environment. 7. #> cd $ORACLE_HOME : 8. #> ./root.sh : execute the root.sh script and answer yes to all prompts. 9. #> su oracle : switch to user oracle. 10. $> emctl start dbconsole : start the dbconsole. 11. Try the "Test Disk Backup" button again. 5. Press the OK button to save the settings 4. Under the Backup Set tab there is no settings necessary to set 5. Under the Policy tab it is possible to tune the backup, however I feel the backup result files become less independent and I choose to skip optimize options. The Retention Policy I like to choose the default "Retain at least the specified number of full backups for each datafile" with a value of 1. This is because it then gives meaning to let a 3. party backup program copy the backup result to a remote backup store and handle the retention period outside of Enterprise Manager control. You are now ready to do backup.
  • 7. PREPARED BY RAVI KUMAR LANKE Page 7 Backup Oracle - using RMAN (CLI) - Windows/Linux/Solaris The RMAN backup procedure depends on whether your Oracle database is in ARCHIVELOG or NOARCHIVELOG mode, therefore start by checking the log_mode : 1. Open a command prompt 2. shell> sqlplus / as sysdba : start SQL*Plus and log in as sysdba 3. sql> select log_name from v$database; : will display whether you are in ARCHIVELOG or NOARCHIVELOG mode 4. sql> exit Now that you know your log_mode, ARCHIVELOG or NOARCHIVELOG, you can choose the appropiate step-by-step procedure :  If in ARCHIVELOG mode : The backup is quite simple because you can take the backup while the database is open (online backup) 1. Open a shell. 2. shell> rman target / : logon to RMAN using host credentials. 3. rman> show all; : shows the environment configuration (that can be setup using the "Enterprise Manager > Availability tab > Backup/Recovery > Backup Settings") 4. rman> backup database plus archivelog; : start backup and include the archivelog since they are needed to secure a consistent restore 5. rman> exit : you are finished.
  • 8. PREPARED BY RAVI KUMAR LANKE Page 8  If in NOARCHIVELOG mode : The backup is less simple because you need to be sure the database is in a consistent state and then mount the database without opening it (offline backup) 1. Open a shell. 2. shell> rman target / : logon to RMAN using host credentials. 3. rman> shutdown immediate; : shutdown and rollback pending transactions (without the immediate keyword, the shutdown will wait for all pending transactions to finish) 4. rman> startup mount; : startup and mount the database but without opening it (datafiles location will be known but not loaded). 5. rman> show all; : shows the environment configuration you did under Configure Oracle backup environment. 6. Depending on configured Backup type : ("Enterprise Manager > Availability tab > Backup/Recovery > Backup Settings")  rman> backup database; : if Backup type = Backup Set (default).  rman> backup as copy database; : if Backup type = Image Copy. 7. rman> alter database open; : open the database (the datafiles will be loaded and the database therefore online). 8. rman> exit : you are finished. The database is now backed up and the resulting backup files located in the Disk backup location (specified then configuring the Oracle backup environment). The resulting backup files could then be copied to some remote storage location for increased security (eg. if the Disk backup location is on the same harddisk as the live datafiles and that harddisk fails, then the backup is not going to help)
  • 9. PREPARED BY RAVI KUMAR LANKE Page 9 Backup Oracle - using Enterprise Manager (GUI) - Windows/Linux/Solaris Note that Enterprise Manager is only a GUI on top of RMAN. Log on to Enterprise Manager as 'sys as sysdba'
  • 10. PREPARED BY RAVI KUMAR LANKE Page 10 Go to "Availability tab > Backup/Recovery > Schedule Backup
  • 11. PREPARED BY RAVI KUMAR LANKE Page 11 On the "Schedule Backup" page you can choose between "Schedule Oracle Suggested Backup" and "Schedule Customized Backup". The main difference between the two is that "Schedule customized backup" allows you to :  Choose between an immediate non-scheduled backup or a scheduled backup.  Override default backup environment settings
  • 12. PREPARED BY RAVI KUMAR LANKE Page 12 Since Oracle suggested backup don't offer any significant convenience, press the "Schedule Customized Backup" button. On the "Options" page accept default "Full Backup" and press the "Next" button
  • 13. PREPARED BY RAVI KUMAR LANKE Page 13 On the "Settings" page the defaults will depend on your Oracle environment configuration, however in case of an immediate single backup you maybe want to change the settings in which case you press the "Override default settings" button. Then you are happy, press the "Next" button
  • 14. PREPARED BY RAVI KUMAR LANKE Page 14 On the "Schedule" page, the job needs a name, a description and a schedule (here One Time Immediately). Press the "Next" button. Press the "Submit Job" button You now have a backup in your designated backup folder. Best to copy that backup to a remote storage, so that if your harddrive fails, you still have a copy of the backup files
  • 15. PREPARED BY RAVI KUMAR LANKE Page 15 Backup Oracle - using Flashback - Windows/Linux/Solaris Flashback is not available in all editions. In editions containing Flashback, Flashback is disabled by default. However, if you have Flashback and you have the disk space, then Flashback is important to enable because it is a more efficient alternative to DBPITR (DataBase Point-In-Time Recovery), that is: then a database needs to roll back because of unwanted changes eg. a user have overwritten data or an administrator have dropped a table. As with DBPITR, Flashback cannot be used in case of media errors, eg. data file corruption. If Flashback is enabled, the database will continously write data file blocks to the flashback logs as well as create, delete and resize them. Flashback logs are not archived and cannot be backed up to disk. First check if flashback is already turned on : 1. Open a shell. 2. #> su oracle : ONLY Solaris : if you have opened a shell as root, you may not be able to use SQL*Plus, so better switch user to oracle. 3. shell> sqlplus / as sysdba : logon to SQL*Plus as sydba. 4. sql> select flashback_on from v$database; : you will get either YES or NO. If Flashback is not enabled, you can enable Flashback using either SQL*Plus or Enterprise Manager :
  • 16. PREPARED BY RAVI KUMAR LANKE Page 16  Enable Flashback using SQL*Plus (CLI) : 1. Open a shell. 2. shell> sqlplus / as sysdba : logon to SQL*Plus as sysdba. 3. sql> alter database set db_flashback_retention_target=4320; : setting flashback retention to 3 days (default is 1440 minutes = 1 day). If fast recovery area disk constraint allows it, this will make it possible to look 3 days into the past 4. sql> alter database flashback on; : enable flashback. If you get error ORA-38703: Media recovery is not enabled, then you are most likely in NOARCHIVELOG mode.  sql> select log_mode from v$database; : confirm your log mode. If you are in NOARCHIVELOG and you want to change to ARCHIVELOG so that you can enable Flashback : 1. sql> shutdown immediate; : 2. sql> startup mount; : 3. sql> alter database archivelog; : 4. sql> alter database open; : 5. sql> alter database flashback on; : this time you should be able to enable flashback.
  • 17. PREPARED BY RAVI KUMAR LANKE Page 17 Enable Flashback using Enterprise Manager (GUI) : Log on to Enterprise Manager as 'sys as sysdba'.
  • 18. PREPARED BY RAVI KUMAR LANKE Page 18 On the Availability tab click on the "Recovery Settings" link
  • 19. PREPARED BY RAVI KUMAR LANKE Page 19 On the Recovery Settings page :
  • 20. PREPARED BY RAVI KUMAR LANKE Page 20 1. Be sure ARCHIVELOG mode is enabled - it is not possible to enable Flashback in NOARCHIVELOG mode. 2. "Flash Recovery Area Size" is the maximum space allocated for Flashback logs, therefor if set too low, it will cap your Flashback Retention Time. (The size of the flashback log is approximately the same as the size of the redo log files, so if the flashback retention is 3 days, then the size of the flashback logs will be 3 times that of the redo logs). 3. Check the "Enable Flashback Database", this it what we came here for. 4. "Flashback Retention Time" is the time you will be able to roll your database back. If set to default 24 hours and you found out that a user overwrote data 25 hours ago, you will not be able to use Flashback to get the overwritten data back.  Disable Flashback using SQL*Plus (CLI) :
  • 21. PREPARED BY RAVI KUMAR LANKE Page 21 (just here for completness) 1. Open a shell. 2. shell> sqlplus / as sysdba : logon to SQL*Plus as sysdba. 3. sql> alter database flashback off; : disable Flashback. Flashback should now be enabled Backup Oracle - using Export - Windows/Linux/solaris Oracles Export (exp) & Import (imp) utilities are popular for backup of Oracle databases smaller than say 50 GB (which is bigger than most databases). The reason they are so popular is because they are both easy and versatile. Oracles Export & Import utilities are used for the following tasks :  Database backup - what we will do here  Reducing fragmentation in the database.  Move data from one owner to another.  Move data from one version to another, eg. from version 9i to 11g.  Moving the database from one operation system to another, eg. from Solaris to Windows. Oracles Export & Import utilities are called exp & imp respectively, however from version 10, Oracle introduced the DataPump utilities called expdp & impdp respectively. The DataPump utilities should be superiour eg. faster and with support for network. The old exp & imp utilities can still be used with Oracle 11gR2. The DataPump utilities, expdp & impdp, works right away, however the old export/import utilities, exp & imp, needs to be prepared by runnning the catexp.sql script : 1. Open a shell 2. shell> sqlplus / as sysdba : logon to SQL*Plus as sys as sysdba using host credentials 3. Execute the catexp.sql script : o Windows : sql> @?rdbmsadmincatexp.sql : @ executes a script and ? points to %ORACLE_HOME%. o Solaris/Linux : sql> @?/rdbms/admin/catexp.sql : @ executes a script and ? points to $ORACLE_HOME. The exp utility can be used in 3 different modes : (from the shell)
  • 22. PREPARED BY RAVI KUMAR LANKE Page 22 Interactive prompt : (holding your hand) shell> exp : start the interactive prompt
  • 23. PREPARED BY RAVI KUMAR LANKE Page 23 ogin. Here i use the same user as I want to export, however you can also use sys as sysdba
  • 24. PREPARED BY RAVI KUMAR LANKE Page 24 specify the dump file location
  • 25. PREPARED BY RAVI KUMAR LANKE Page 25 specify how to choose objects - here I want to export all objects for specific users
  • 26. PREPARED BY RAVI KUMAR LANKE Page 26
  • 27. PREPARED BY RAVI KUMAR LANKE Page 27 I am not sure what it means if you choose no, maybe all objects will be free of permissions
  • 28. PREPARED BY RAVI KUMAR LANKE Page 28 yes, I want to export the data, however if I chose no I would get only the table structures
  • 29. PREPARED BY RAVI KUMAR LANKE Page 29 yes just compress it
  • 30. PREPARED BY RAVI KUMAR LANKE Page 30 choose the users for which I want to export objects, here just one user : rasmus
  • 31. PREPARED BY RAVI KUMAR LANKE Page 31 the rasmus user have only one table with only 1 row
  • 32. PREPARED BY RAVI KUMAR LANKE Page 32
  • 33. PREPARED BY RAVI KUMAR LANKE Page 33 that went well.
  • 34. PREPARED BY RAVI KUMAR LANKE Page 34
  • 35. PREPARED BY RAVI KUMAR LANKE Page 35  Standard command line : (fast dump on-the-fly) o shell> exp scott/tiger file=scott.dmp : fast dumping all objects belonging to scott (note that scott/tiger is the credentials used to login to the exp utility - it is just default that you will then export the scott objects if nothing else specified) o shell> exp scott/tiger file=scott.dmp log=scott.log : fast dumping all objects belonging to scott and also a log file to see how the export went o shell> exp scott/tiger file=scott.dmp log=scott.log tables=(tbl1,tbl2) : dumping only the tables tbl1 & tbl2 (these tables must belong to scott) and a log file. o shell> exp scott/tiger file=scott.dmp log=scott.log tables=(tbl1,tbl2) rows=no : dumping only the structures (not the data) of tables tbl1 & tbl2 and a log file.  Command line with parameter file : (if you need many parameters and you need to do it often) o no examples
  • 36. PREPARED BY RAVI KUMAR LANKE Page 36 Appendix : SQL*Plus & RMAN : logon & management commands  Logon to SQL*Plus (no normal logon for user sys - either use as sysdba or as sysoper) o shell> sqlplus / as sysdba : logon to SQL*Plus as sys as sysdba using host credentials. o shell> sqlplus sys/SysPassword as sysdba : logon to SQL*Plus as sys as sysdba using sys password. o shell> sqlplus scott/tiger : logon to SQL*Plus as scott who have the password tiger.  Logon to RMAN : o shell> rman target / : logon to RMAN using host credentials. o shell> rman : start the RMAN shell to logon from within RMAN :  rman> connect target sys@orcl : format user@dbname.  rman> connect target sys@ipadress/orcl : format user@ipaddress/dbname.  rman> connect target sys@localhost/orcl) : format user@host/dbname.  SQL*Plus management commands (most will require that you are logged on as sysdba) o Managing database :  sql> shutdown : database will wait for all pending transactions to commit, then close, then dismount, then shutdown.  sql> shutdown immediate : instead of waiting to commit all pending transactions, Oracle will roll them all back - fast shutdown.  sql> startup nomount : will start the database instance but not mount it. Then issuing the startup command, Oracle will read the initalization parameter file (init.ora or spfile) to get database configuration eg. size of all memory areas which will then be allocated and all background processes will be started and together these processes and allocated memory is called an Oracle instance and that instance is now started.  sql> startup mount : will start and then mount the database but not open it. In the mount stage, the control file is read to locate the datafiles but without opening them (without making access possible) - the instance is now mounted. Obviously this is the right stage in which to take backup since the datafile locations are now known and most likely consistent (except for online backup that qua log files do not need consistent datafiles).  sql> startup : will start, mount and open the database. An open database is also called an online database and makes it possible to access the datafiles through Oracle eg. using sql (Stages in starting an Oracle database).  sql> alter database mount; : change a nomounted to mounted.  sql> alter database open; : change a mounted not opened to opened.  sql> alter database open resetlogs; : change a mounted not opened to opened and starts a new incarnation.  sql> select name from v$database; : find the name of your database.
  • 37. PREPARED BY RAVI KUMAR LANKE Page 37  sql> select log_mode from v$database; : find out if your database is in ARCHIVELOG or NOARCHIVELOG mode.  sql> select open_mode from v$database; : show access, eg. OPEN WRITE (gives error ORA-01034: ORACLE not available if the instance is not started).  sql> show parameters CONTROL_FILES; : find the path to your control files.  sql> select * from v$database_incarnation; : list all incarnations, however RMAN creates a more nice list : rman> list incarnation;  sql> select value$ from sys.props$ where name = 'NLS_CHARACTERSET'; : shows the database ordinary characterset.  sql> select * from nls_database_parameters; : shows additional language information. NSL_CHARACTERSET is ordinary and NLS__NCHAR_CHARACTERSET is national characterset.  sql> alter database character set WE8MSWIN1252; : changes the characterset to WE8MSWIN1252 - note if the new character is not a superset of the old, you will get ora-12712: new character set must be a superset of old character set. (Official Character set Migration should be consulted). o Managing users :  sql> select * from all_users; : fast list of all users.  sql> select username, user_id, account_status from dba_users order by username; : dba_users contains quite a lot more info than all_users.  sql> select user#, name from sys.user$; : more users and more info.  sql> create user rasmus identified by myPassword; : creating a user called rasmus with the password myPassword.  sql> alter user rasmus identified by newPassword; : change the password for rasmus from myPassword to newPassword.  sql> grant connect to rasmus; : granting rasmus connect privilege.  sql> create tablespace tsrasmus datafile 'C:apporadataorcltsrasmus.dbf' size 20M;create a tablespace with a 20 MB datafile.  sql> alter user rasmus default tablespace tsrasmus quota unlimited on tsrasmus; : specify that rasmus default should store objects in tsrasmus instead of in the user tablespace.  sql> alter user rasmus account unlock; : unlock the rasmus user account.  sql> drop user rasmus cascade; : deleting the rasmus user. Specify cascade to also delete all objects belonging to rasmus. o Managing tables :  sql> desc dba_users; : show the structure of the dba_users table.  sql> select * from cat; : shows all tables belonging to current user.  sql> select table_name from dictionary; have less tables but more information.  sql> select table_name from dba_tables; : shows all tables in the database regardless of user and having a lot of info.
  • 38. PREPARED BY RAVI KUMAR LANKE Page 38  sql> select owner, table_name, tablespace_name from dba_tables where owner = 'RASMUS'; : show all tables and there they are stored for the rasmus user.  sql> create table employees (firstname varchar2(100), age number); : creating a table called employees.  sql> drop table employees; : deleting the employees table. o Managing SQL*Plus :  sql> show all; : show all SQL*Plus settings.  sql> help topics; : list all topics that there are help for.  sql> @myscript.sql : executes myscript.sql which must be in the current directory  sql> @C:appproductdbhome_1rdbmsadmincatexp.sql : if the script is not in current directory, then specify the full path.  sql> @?rdbmsadmincatexp.sql : ? is a shorthand for %ORACLE_HOME% (windows) or $ORACLE_HOME (solaris/linux).  sql> ed myscript.sql; : starts an associated text editor and opens op myscript.sql from current directory.  sql> define; : will show all defined variables.  sql> define rasmus=programmer : declare a new variable called rasmus and initializes it with the value programmer.  sql> undefine rasmus; : Appendix : Oracle backup related concepts :  RMAN : Recovery MANager command utility. Preferred to to backup & restore Oracle databases as it provides an OS independent interface as well as removes OS dependencies in the backup files  RMAN Repository : records of database files and backups for each database on which RMAN performs operations. These meta data are stored in the control file of the target database, therefore you should always backup the control file.  Enterprise Manager : (normally abbreviated EM or OEM) : Web application to manage Oracle. It is possible to perform and schedule backups using EM (EM backup will use RMAN underneath and as such EM is a GUI frontend to RMAN)  Fast Recovery Area : (earlier named flash recovery area). A directory to store recovery related files such as control file, online redo log copies, archived redo log files, flashback logs and RMAN backups. Oracle & RMAN automatically manage the files in this directory, eg. automatically delete files that are no longer needed.  Oracle Flashback : Oracle Flashback is built-in to some but not all Oracle database editions and enables you to recover data from unwanted database changes without restoring files from backup or performing media recovery - this feature relies on undo data. Flashback must be turned on though and can be turned on for individual tables and a retention period must be specified, this will create a flashback data archive.  SCN : System Change Number : Everytime a transaction is committed, Oracle records a new SCN. Then Oracle starts up, Oracle check SCN in all datafile headers and in the
  • 39. PREPARED BY RAVI KUMAR LANKE Page 39 control file and if they are all the same then the database is consistent. If they are not the same, the database is in need of recovery.  Offline Backup : (sometimes called cold backup) backups that run when the database is in the mounted but not open state. Oracle in NOARCHIVELOG log_mode must do offline backup  Online Backup : (sometimes called hot backup) backups that run when the database is in open state. Oracle in ARCHIVELOG log_mode can do online backup  log_mode : Oracle can be in either ARCHIVELOG or NOARCHIVELOG log_mode. The ARCHIVELOG have 2 advantages o Oracle can do Online Backup o Oracle can restore ALL committed data to the point of failure as opposed to NOARCHIVELOG log_mode there Oracle restore will loose all data committed since the last backup  Physical >< Logical Backup : Physical backup refers to the files making up the database while Logical backup referes to data, tables etc. Oracle backup is mostly physical backup  Backing up a database : means to make copies of the data files, control file and if in ARCHIVELOG mode then also copies of archived redo log files  Restoring a database : means copying the physical files that comprise the database from a backup medium (disk or tape) to their original or to new locations  Database recovery : is the process of updating database files restored from a backup with the changes made to the database after the backup (typically using the redo log files)  Media Recovery : most often used to recover from media failure, eg. loss of a file or disk or a user error eg. deletion of the contents of a table. Media recovery requires a control file, data filees (typically restored from backup) and online and archived redo log files (that contains the changes since the time the data files were backed up.  Control file : contains among other things names & locations of data files and online & archive log records and backup records. Also without the control file, the database cannot be mounted and therefore recovery cannot be performed - you need to backup the control file.  SPFILE : Server Parameter file : A binary parameter file that Oracle is using upon startup (alternatively a text based PFILE can be used). The name of the SPFILE may be spfileSID.ora, where SID is the database name (PFILE nomenclature is initSID.ora). If no parameter file can be found, Oracle cannot start up.  Table spaces : Logical storage unit (logical because there is no file representation on the file system) used to organizing objects. A table space have at least one data file and a data file can only belong to one table space. Tables, indexes etc. belongs to a tablespace. Table spaces can be created, but then a database is created it will be created with 5 default table spaces : system, sysaux, temp, undotbs1 & users.  Data files : Physical representation of the table spaces, that is: data files physically holds the data.  Schema : Collection of objects owned by a user of the same name. Eg if the user is Rasmus, then all objects like tables, views, indexes etc. owned by Rasmus is collected in a Schema named Rasmus.  Management Repository Encryption key : If Enterprise Manager data is encrypted (Management Repository has been placed in secure mode), then this key MUST be
  • 40. PREPARED BY RAVI KUMAR LANKE Page 40 backed up as the encrypted data will become unusable if this file is lost. Location is : /export/home/oracle/app/oracle/product/11.2.0/dbhome_1/localhost_orcl/sysman/config/e mkey.ora. Appendix : default Oracle file locations Below USER_NAME is the user that installed Oracle.  Fast Recovery Area (called flash recovery area on Oracle Express XE 10g) o Oracle 11gR2 on Windows : C:appUSER_NAMEflash_recovery_areaDB_NAME o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/flash_recovery_area o Oracle Express XE 10g on Windows : C:oraclexeapporacleflash_recovery_areaXE o Oracle Express XE 10g on Linux : /usr/lib/oracle/xe/app/oracle/flash_recovery_area/  Data files : o Oracle 11gR2 on Windows : C:appUSER_NAMEoradataDB_NAME o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/oradata/??  Installation files : o Oracle 11gR2 on Solaris : /export/home/oracle/app/oraInventory/PRODUCT_NAME  Control file : o Oracle 11gR2 on Windows : C:appUSER_NAMEoradataDB_NAME (same place as the data files)  SPFILE : o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl.ora  listener.ora & tnsnames.ora : o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin  oratab : (defines home folders for each database instance in the format SID:FOLDER) o Oracle 11gR2 on Solaris : /var/opt/oracle/oratab o Oracle 11gR2 on Linux : /var/oratab  Environment Variables : o Oracle 11gR2 on Solaris $ORACLE_BASE : /export/home/oracle/app/oracle o Oracle 11gR2 on Solaris $ORACLE_HOME : /export/home/oracle/app/oracle/product/11.2.0/dbhome_1 o Oracle 11gR2 on Solaris $ORACLE_OWNER : oracle o Oracle 11gR2 on Solaris $ORACLE_SID : orcl
  • 41. PREPARED BY RAVI KUMAR LANKE Page 41 Appendix : Common errors & Solutions 1. c:> emctl dbconsole status : errors EM Configuration issue. c:appUSERNAMEproduct11.2.0dbhome_1/HOSTNAME_DBNAME not found 2. $> emctl dbconsole status : errors EM Configuration issue. /export/home/app/oracle/product/aa.2.0/dbhome_1/HOSTNAME_DBNAME not found 3. $> emctl dbconsole start : exactly the same error as 2. 4. $> emctl start dbconsole : errors OC4J Configuration issue. .../oc4j/j2ee/OC4J_DBConsole_HOSTNAME_DBNAME not found Reason : If you have one of the above errors, 1, 2, 3 or 4, you have most likely not set the $ORACLE_HOSTNAME environment variable. The problem is that the Oracle installer will use localhost for HOSTNAME at least then installing a desktop class system. However, then services start, Oracle will match hostname with $ORACLE_HOSTNAME and if $ORACLE_HOSTNAME is empty then substitute with the system hostname, which likely is different from localhost. Example : If your hostname is Solaris10 and your database name is orcl, then emctl will search for ../oc4j/j2ee/OC4J_DBConsole_Solaris10_orcl, but the installer created ../oc4j/j2ee/OC4J_DBConsole_localhost_orcl. Solution : There are different possible solutions of which by far the easiest is to set the $ORACLE_HOSTNAME to localhost : 1. On Windows 1. Open a shell. 2. c:> set ORACLE_HOSTNAME=localhost : declare, initialize and add the variable to your environment 3. c:> echo %ORACLE_HOSTNAME% : confirm the variable - you should get localhost. 2. On Solaris 1. Open a shell. 2. #> ORACLE_HOSTNAME=localhost : declare & initialize the variable. 3. #> export ORACLE_HOSTNAME : add the variable to your environment. 4. #> echo $ORACLE_HOSTNAME : confirm the variable - you should get localhost.
  • 42. PREPARED BY RAVI KUMAR LANKE Page 42 To persist $ORACLE_HOSTNAME on system boot (Solaris), please see here (step 9). 5. c:> emctl dbconsole status : errors Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name. Solution : Set the ORACLE_UNQNAME to the value of your database name :  On Windows 1. Open a shell. 2. c:> set ORACLE_UNQNAME=orcl : declare, initialize and add the variable to your environment 3. c:> echo %ORACLE_UNQNAME% : confirm the variable - you should get orcl.  On Solaris 1. Open a shell. 2. #> ORACLE_UNQNAME=localhost : declare & initialize the variable. 3. #> export ORACLE_UNQNAME : add the variable to your environment. 4. #> echo $ORACLE_UNQNAME : confirm the variable - you should get orcl. Enterprise Manager cannot connect.
  • 43. PREPARED BY RAVI KUMAR LANKE Page 43 Solution : This solution worked for me. If it does not work for you, you can read more here 1. On Windows 1. Open a shell. 2. c:> set ORACLE_SID=orcl : declare, initialize and add the variable to your environment 3. c:> emca -deconfig dbconsole db : you will be prompted for your database name. 4. c:> emca -config dbconsole db : you will be prompted for dbname, several passwords, ORACLE_HOME and Listener port number (default 1521). 5. Refresh Enterprise Manager in your browser.
  • 44. PREPARED BY RAVI KUMAR LANKE Page 44 sql> alter database open; : errors ORA-38760: This database instance failed to turn on flashback database Solution : Turning flashback off and then on should solve the problem, however any guaranteed restore point need to dropped. 1. You should already be in your SQL*Plus shell. 2. Be sure your database is started and in mounted stage : 1. sql> shutdown immediate; 2. sql> startup mount; 3. Check for quaranteed restore points and delete them if found : 1. sql> select name, scn, guarantee_flashback_database, database_incarnation# from v$restore_point; : list your restore points. 2. If you found any then drop them Example: sql> drop restore point RESTORE_POINT_NAME;. 4. sql> alter database flashback off; : turn off flashback. 5. sql> alter database flashback on; : turn on flashback. 6. sql> alter database open; : this time you should succeed. Enterprise Manager import/export give error ORA-20446: The owner of the job is not registered ORA- 06512: at "SYSMAN.MGMT_JOBS", line 168 ORA-06512: at "SYSMAN.MGMT_JOBS", line 86 ORA-06512: at line 1.
  • 45. PREPARED BY RAVI KUMAR LANKE Page 45 Reason : This is likely a bug in Oracle 11g Solution : 1. On Windows/Solaris/Linux 1. Open a shell. 2. shell> sqlplus sysman/SysmanPassword : logon to SQL*Plus as SYSMAN. 3. sql> execute MGMT_USER.MAKE_EM_USER(‘USERID’); : USERID is the user that you use to login to Enterprise Manager then doing import/export. 4. Try running import/export again.