Oracle 10 Gb database logical backup

Source: Internet
Author: User

1. First, I created a user named "bkjia" and set his password to "bkjia123" (an SQL statement operated as sys)

Create user bkjia identified by bkjia123;

2. assign some permissions to new users

Grant create session to bkjia;
Grant create table to bkjia;

3. Create a directory to store files. (Root operation on the server. And modify the owner and group attributes for this object)

[Root @ www.bkjia.com ~] # Cd/u01/

[Root @ www.bkjia.com u01] # mkdir ts

[Root @ www.bkjia.com u01] # chown-R Oracle: oinstall ts

4. Create a tablespace named "bkjia. Add the bkjia user to the bkjia tablespace. And allocate a certain amount of space to him (sys identity)

Create tablespace bkjia
Datafile '/u01/ts/bkjia001.dbf'
Size 20 m;

Alter user bkjia default tablespace bkjia;

Alter user bkjia quota 20 m on bkjia;

5. log on with your bkjia account. Create a test table named test1.

Create table test1 (
Ts int, tsname varchar2 (30 ));

6. Create a backup directory and use exp to export the data (executed on the server)

[Oracle @ www.bkjia.com u01] $ mkdir dump

[Root @ www.bkjia.com u01] # chown-R oracle: oinstall dump

[Root @ www.bkjia.com u01] # chmod 775 dump

[Oracle @ www.bkjia.com dump] $ exp

Export: Release 10.2.0.1.0-Production on Wed May 16 06:44:20 2012

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Username: sys as sysdba
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
Enter array fetch buffer size: 4096 & gt;

Export file: expdat. dmp & gt;/u01/dump/emp052209.dmp -- select the target file and storage path for the object to be backed up

(1) E (ntire database), (2) U (sers), or (3) T (ables): (2) U & gt; t -- the backup of the table is suspended here

Export table data (yes/no): yes & gt;

Compress extents (yes/no): yes & gt; -- default compression backup file

Export done in US7ASCII character set and AL16UTF16 NCHAR character set
Server uses AL32UTF8 character set (possible charset conversion)

About to export specified tables via Conventional Path...
Table (T) or Partition (T: P) to be exported: (RETURN to quit) & gt; scott. emp -- Name of the Table to be exported, specifying the User Name of the Table

Current user changed to SCOTT
.. Exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Table (T) or Partition (T: P) to be exported: (RETURN to quit) & gt;

Export terminated successfully with warnings.

The backup has been completed.

7. Use imp to import backup data

[Oracle @ www.bkjia.com dump] $ imp

Import: Release 10.2.0.1.0-Production on Wed May 16 07:07:21 2012

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Username: sys as sysdba
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options

Import file: expdat. dmp & gt;/u01/empo52209.dmp -- specify the backup file to be imported and its path

IMP-00002: failed to open/u01/empo52209.dmp for read
Import file: expdat. dmp & gt;/u01/dump/emp052209.dmp

Enter insert buffer size (minimum is 8192) 30720 & gt;

Export file created by EXPORT: V10.02.01 via conventional path
Import done in US7ASCII character set and AL16UTF16 NCHAR character set
Import server uses AL32UTF8 character set (possible charset conversion)
List contents of import file only (yes/no): no & gt;

Ignore create error due to object existence (yes/no): no & gt; yes -- Ignore error prompt

Import grants (yes/no): yes & gt;

Import table data (yes/no): yes & gt;

Import entire export file (yes/no): no & gt;
Username: scott -- user to which the table belongs

Enter table (T) or partition (T: P) names. Null list means all tables for user
Enter table (T) or partition (T: P) name or. if done:

. Importing SYS's objects into SYS
. Importing SCOTT's objects into SCOTT
.. Importing table "EMP" 14 rows imported
About to enable constraints...
Import terminated successfully with warnings.
[Oracle @ www.bkjia.com dump] $

This process is logical backup.

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.