Migration of Oracle data files

Source: Internet
Author: User
1. Check the current data file. You can see that there are seven data files on drive F: SQLgt; selectname, file # fromv $ datafile; NAME -------------

1. Check the current data file. You can see that there are seven data files on drive F: SQLgt; select name, file # from v $ datafile; NAME -------------

1. Check the current data file. Seven data files are displayed on drive F.
SQL> select name, file # from v $ datafile;

NAME
---------------------------
FILE #
----
F: OraclePRODUCT10.2.0ORADATASGECSYSTEM01. DBF
1

F: ORACLEPRODUCT10.2.0ORADATASGECUNDOTBS01. DBF
2

F: ORACLEPRODUCT10.2.0ORADATASGECSYSAUX01. DBF
3

NAME
---------------------------
FILE #
----
F: ORACLEPRODUCT10.2.0ORADATASGECUSERS01. DBF
4

F: ORACLEPRODUCT10.2.0ORADATASGECEXAMPLE01. DBF
5

F: ORACLEPRODUCT10.2.0ORADATASGECYJZX
6

NAME
---------------------------
FILE #
----
F: ORACLEPRODUCT10.2.0ORADATASGECWSEC _ MAIN. DBF
7

You have selected 7 rows.

2. view the redo log. Three redo log files are displayed on drive F.

SQL> select * from v $ logfile;

GROUP # STATUS TYPE
----------
MEMBER
---------------------------
IS _
-
3 ONLINE
F: ORACLEPRODUCT10.2.0ORADATASGECREDO03. LOG
NO

2 ONLINE
F: ORACLEPRODUCT10.2.0ORADATASGECREDO02. LOG
NO

GROUP # STATUS TYPE
----------
MEMBER
---------------------------
IS _
-

1 ONLINE
F: ORACLEPRODUCT10.2.0ORADATASGECREDO01. LOG
NO

3. view the control file. You can see that drive F has three control files.
SQL> select * from v $ controlfile;

STATUS
---
NAME
---------------------------
IS _ BLOCK_SIZE FILE_SIZE_BLKS
----------

F: ORACLEPRODUCT10.2.0ORADATASGECCONTROL01. CTL
NO 16384 430

F: ORACLEPRODUCT10.2.0ORADATASGECCONTROL02. CTL
NO 16384 430

STATUS
---
NAME
---------------------------
IS _ BLOCK_SIZE FILE_SIZE_BLKS
----------

F: ORACLEPRODUCT10.2.0ORADATASGECCONTROL03. CTL
NO 16384 430

4. Export pfile and modify the control file location in pfile. This file will be used in subsequent steps.

SQL> create pfile = 'C: pfile. ora 'from spfile;

Open pfile. ora and change the control file location:
*. Control_files = 'H: oradataorclcontrol01.ctl ', 'H: oradataorclcontrol02.ctl', 'H: oradataorclcontrol03.ctl'

5. Stop database listening
Lsnrctl stop

6. Stop the database.
SQL> shutdown immediate
The database has been closed.
The database has been detached.
The ORACLE routine has been disabled.

7. Copy F: oracleproduct10.2.0oradata to H;

8. Use the modified pfile to start the database to the mount status.
SQL> startup mount pfile = 'C: pfile. ora ';
The ORACLE routine has been started.

Total System Global Area 222298112 bytes
Fixed Size 1248212 bytes
Variable Size 75498540 bytes
Database Buffers 142606336 bytes
Redo Buffers 2945024 bytes
The database has been loaded.

9. Modify database file path parameters

Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECSYSTEM01. dbf' to 'H: oradatasgecsystem01.dbf ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECUNDOTBS01. dbf' to 'H: oradatasgecundotbs01.dbf ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECSYSAUX01. dbf' to 'H: oradatasgecsysaux01.dbf ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECUSERS01. dbf' to 'H: oradatasgecusers01.dbf ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECEXAMPLE01. dbf' to 'H: oradatasgecexample01.dbf ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECYJZX 'to 'H: oradatasgecyjzx ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECWSEC _ MAIN. dbf' to 'H: oradatasgecwsec_main.dbf ';

Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECTEMP01. dbf' to 'H: oradatasgectemp01.dbf ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECWSEC _ TEMP. dbf' to 'H: oradatasgecwsec_temp.dbf ';

10. Modify log file path parameters
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECREDO03. log' to 'H: ORADATASGECREDO03.LOG ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECREDO02. log' to 'H: ORADATASGECREDO02.LOG ';
Alter database rename file 'f: ORACLEPRODUCT10.2.0ORADATASGECREDO01. log' to 'H: oradatasgecredo01.log ';

11. Use pfile to recreate spfile
SQL> create spfile from pfile = 'C: pfile. ora ';

12. Change the database to the open state.
SQL> alter database open;

The database has been changed.

SQL> alter system switch logfile;

The system has been changed.

13. Stop the database
SQL> shutdown immediate
The database has been closed.
The database has been detached.
The ORACLE routine has been disabled.

14. Start the database
SQL> startup

15. Verify the migration result and confirm that the data files, redo log files and control files have been migrated to the H disk.
SQL> select name, file # from v $ datafile;
SQL> select * from v $ logfile;
SQL> select * from v $ controlfile;

16. Start database listening after confirmation
Lsntctl start

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.