HOT BACKUP / Best Practic


[oracle@orcl ~]$ export ORACLE_SID=ORCL

[oracle@orcl ~]$ sqlplus sys as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Fri Oct 31 11:45:24 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.

SQL> startup;
ORACLE instance started.
Total System Global Area 348127232 bytes
Fixed Size 1219328 bytes
Variable Size 289408256 bytes
Database Buffers 50331648 bytes
Redo Buffers 7168000 bytes
Database mounted.

Database opened.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/ORCL/archive
Oldest online log sequence 81
Next log sequence to archive 82
Current log sequence 82

SQL> select name from v$datafile;
NAME
——————————————————————————–
/home/oracle/ORCL/datafiles/system01.dbf
/home/oracle/ORCL/datafiles/undotbs1.dbf
/home/oracle/ORCL/datafiles/sysaux01.dbf
/home/oracle/ORCL/datafiles/users01.dbf

SQL> select name from v$controlfile;
NAME
——————————————————————————–
/home/oracle/ORCL/control/a1.ctl
SQL> show parameter pfile;
NAME TYPE VALUE
———————————— ———– ——————————
spfile string /home/oracle/oracle/product/10
.2.0/db_1/dbs/spfileORCL.ora

SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
——————————
SYSTEM
UNDOTBS1
SYSAUX
TEMP
USERS

SQL> alter tablespace system begin backup;
Tablespace altered.
SQL> alter tablespace undotbs1 begin backup;
Tablespace altered.

SQL> alter tablespace sysaux begin backup;
Tablespace altered.

SQL> alter tablespace users begin backup;
Tablespace altered.

SQL> !
[oracle@orcl ~]$ mkdir backup

[oracle@orcl ~]$ cd ORCL/

[oracle@orcl ORCL]$ ls
archive bdump control datafiles dbc.sql udump
[oracle@orcl ORCL]$ cd archive/
[oracle@orcl archive]$ ls
arch_1_668961233_71.arc arch_1_668961233_75.arc arch_1_668961233_79.arc
arch_1_668961233_72.arc arch_1_668961233_76.arc arch_1_668961233_80.arc
arch_1_668961233_73.arc arch_1_668961233_77.arc arch_1_668961233_81.arc
arch_1_668961233_74.arc arch_1_668961233_78.arc

[oracle@orcl archive]$ cp *.arc /home/oracle/backup/

[oracle@orcl archive]$ cd ..

[oracle@orcl ORCL]$ cd control/

[oracle@orcl control]$ ls
a1.ctl
[oracle@orcl control]$ cp a1.ctl /home/oracle/backup/

[oracle@orcl control]$ cd ..

[oracle@orcl ORCL]$ cd datafiles/

[oracle@orcl datafiles]$ ls
redo01.log redo02.log sysaux01.dbf system01.dbf temp01.dbf undotbs1.dbf users01.dbf

[oracle@orcl datafiles]$ cp *.dbf /home/oracle/backup/

[oracle@orcl datafiles]$ cd $ORACLE_HOME/dbs

[oracle@orcl dbs]$ ls
initORCL.ora spfileORCL.ora

[oracle@orcl dbs]$ cp initORCL.ora /home/oracle/backup

[oracle@orcl dbs]$ cp spfileORCL.ora /home/oracle/backup/

[oracle@orcl dbs]$ cd

[oracle@orcl ~]$ cd backup/

[oracle@orcl backup]$ ls
arch_1_668961233_71.arc arch_1_668961233_76.arc arch_1_668961233_81.arc system01.dbf
arch_1_668961233_72.arc arch_1_668961233_77.arc a1.ctl temp01.dbf
arch_1_668961233_73.arc arch_1_668961233_78.arc initORCL.ora undotbs1.dbf
arch_1_668961233_74.arc arch_1_668961233_79.arc spfileORCL.ora users01.dbf
arch_1_668961233_75.arc arch_1_668961233_80.arc sysaux01.dbf

[oracle@orcl backup]$ sqlplus "/ as sysdba"

SQL> alter tablespace system end backup;
Tablespace altered.

SQL> alter tablespace undotbs1 end backup;
Tablespace altered.

SQL> alter tablespace sysaux end backup;
Tablespace altered.

SQL> alter tablespace users end backup;
Tablespace altered
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: