Handmade Database Step by STEP

zhaozj2021-02-16  52

Handmade Database Step by STEP

Author: kamus

Mail: kamus@itpub.net

Date: 2004-1

Sometimes we will encounter such a situation, existing databases are transferred from a machine to another machine, usually we will use export, import. However, if the data of the database is large, the data file size is large, then the process of exporting the import is likely to have problems, and the long process is also we can't tolerate. In this case, we can simply use the Copy command of the operating system to transfer the data directly.

The following examples are in the Redhat Fedora Core 1 Oracle

9.2.0

.1 operations, other operating systems and Oracle versions are equally applicable.

Suppose our databases on the server A, $ oracle_base is / oracle, $ oracle_home is / Oracle / Product /

9.2.0

. Now we have to transfer this database to the server B, and new $ oracle_base is / u01 / oracle, $ Oracle_home is /u01/oracle/product/9.2.0. The SID is ORINUX.

The steps are as follows:

One. Install Oracle on server B, do not create a database during installation. The user's Profile can come directly from the server A, pay attention to the original $ ORACLE_HOME to the present position.

two. If the Oracle on the server A is using SPFile, then create a PFile according to this spfile:

Create Pfile from SPFILE;

three. Turn off the database on the server A, Shutdown Immediate. If the database is not allowed to close, you can use online backups, which must be in the case of ArchiveLog mode, the principle of transfer, and the case where it is allowed, is not discussed here.

four. Back up all data files on the server A, including the following:

a) All DataFile (temporary files can be not copy, such as Temp01.dbf)

b) All Online Redo Log

c) All Archive Redo Log

d) All Control File

e) $ oracle_home / dbs / init .ora (this file is created in the second step above)

f) $ oracle_home / dbs / orapw (this is Password file)

g) $ oracle_home / network / listener.ora (this can be omitted, you can regenerate it later)

H) $ Oracle_base / admin / / under all directories, usually udump, cdump, bdump (this can be omitted, and manually create a directory)

Fives. The above-described backup file is uploaded to the corresponding directory of the server B by FTP or other tools. For example, it is originally on the server A. Oracle_base / oradata / /system01.dbf, now upload to $ oracle_base / oradata / /system01.dbf on the server B, to ensure the logical structure of the directory, actually physically The structure has changed ($ oracle_base is / oracle on a), and B is / u01 / oracle). Other documents are treated, if there is no corresponding directory on the server B, then manually created. six. Edit uploaded to the INIT . OA file on the server B, the directory structure involved is all changed to the current directory structure in B. For example, this example is changed to / u01 / oracle.

Seven. On Server B, SQLPLUS "/ as sysdba" prompts to enter the idle process.

Eight. Create SPFILE, CREATE SPFILE from Pfile according to the modified Pfile;

nine. Start the database to the mount status, Startup Mount;

ten. Modify the location of all data files in the Control File, you can generate all SQL via spool:

SQL> ALTER DATABASE RENAME File '/oracle/oradata/oralinux/system01.dbf'

2 to '/u01/oracle/oradata/oralinux/system01.dbf';

Follow the above syntax to modify all data file locations.

eleven. At this point the database is already available, ALTER DATABASE OPEN;

twelve. Add a temporary file to the TEMP table space:

Alter TableSpace Temp Add Tempfile '/u01/oracle/oradata/oralinux/temp01.dbf' size

20m

;

thirteen. There are also some follow-up, including updating the listening profile on the database B (actually not tube, because the 9i instance can be automatically registered to the listener, if it is a listening to the database, then immediately register, if It is the first to listen to the database, then it will be slightly delayed to register), modify the / etc / oratab file to be able to use dbstart and dbshut scripts.

Such a database is completely transferred, if there is any problem, you can send me an email.

转载请注明原文地址:https://www.9cbs.com/read-21931.html

New Post(0)