How does the Oracle database change the location of tablespace data files?

Source: Internet
Author: User

Microsoft Windows 2000 [version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:/Documents and Settings/Administrator> sqlplus/nolog

SQL * Plus: Release 9.2.0.6.0-production on Wednesday August 1 11:42:37 2007

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

SQL> conn sys @ Henry as sysdba
Enter the password:
Already connected to the idle routine.
SQL> -- in Open Mode
SQL> startup open
The Oracle routine has been started.

Total system global area 135340020 bytes
Fixed size 454644 bytes
Variable Size 109051904 bytes
Database buffers 25165824 bytes
Redo buffers 667648 bytes
The database has been loaded.
The database has been opened.
SQL> -- In the use case, change the file from D:/Oracle/oradata/mars_base_data03.dbf to D:/Oracle/or.
AData/Henry/mars_base_data03.dbf'
SQL> select name from V $ datafile;

Name
--------------------------------------------------------------------------------

D:/Oracle/oradata/Henry/system01.dbf
D:/Oracle/oradata/Henry/undotbs01.dbf
D:/Oracle/oradata/Henry/cwmlite01.dbf
D:/Oracle/oradata/Henry/drsys01.dbf
D:/Oracle/oradata/Henry/example01.dbf
D:/Oracle/oradata/Henry/indx01.dbf
D:/Oracle/oradata/Henry/odm01.dbf
D:/Oracle/oradata/Henry/tools01.dbf
D:/Oracle/oradata/Henry/users01.dbf
D:/Oracle/oradata/Henry/xdb01.dbf
D:/Oracle/oradata/Henry/mars_base_data01.dbf

Name
--------------------------------------------------------------------------------

D:/Oracle/oradata/Henry/mars_base_data02.dbf
D:/Oracle/oradata/Henry/mars_idx01.dbf
D:/Oracle/oradata/mars_base_data03.dbf

14 rows have been selected.

SQL> -- Take the tablespace offline first
SQL> alter tablespace mars_base_data offline;

The tablespace has been changed.

SQL> -- transfer a file to a new address in the operating system
SQL> -- Transfer Process omitted
SQL> alter tablespace mars_base_data rename datafile 'd:/Oracle/oradata/mars_bas
E_data03.dbf 'to 'd:/Oracle/oradata/Henry/mars_base_data03.dbf ';

The tablespace has been changed.

SQL> -- bring the tablespace online
SQL> alter tablespace mars_base_data online;

The tablespace has been changed.

SQL> select name from V $ datafile;

Name
--------------------------------------------------------------------------------

D:/Oracle/oradata/Henry/system01.dbf
D:/Oracle/oradata/Henry/undotbs01.dbf
D:/Oracle/oradata/Henry/cwmlite01.dbf
D:/Oracle/oradata/Henry/drsys01.dbf
D:/Oracle/oradata/Henry/example01.dbf
D:/Oracle/oradata/Henry/indx01.dbf
D:/Oracle/oradata/Henry/odm01.dbf
D:/Oracle/oradata/Henry/tools01.dbf
D:/Oracle/oradata/Henry/users01.dbf
D:/Oracle/oradata/Henry/xdb01.dbf
D:/Oracle/oradata/Henry/mars_base_data01.dbf

Name
--------------------------------------------------------------------------------

D:/Oracle/oradata/Henry/mars_base_data02.dbf
D:/Oracle/oradata/Henry/mars_idx01.dbf
D:/Oracle/oradata/Henry/mars_base_data03.dbf

14 rows have been selected.

SQL>

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.