How to remove spaces in Oracle Data File Names

Source: Internet
Author: User
There are often multiple spaces in the middle or end of the data file name when creating a tablespace. How can we remove the spaces in the name? How can we remove them in the following experiment. Rename

There are often multiple spaces in the middle or end of the data file name when creating a tablespace. How can we remove the spaces in the name? How can we remove them in the following experiment. Rename

Environment: Oracle Linux Server release 6.4 oracle 11.2.0.1.0

Problem description and analysis: There are often multiple spaces in the middle or end of the data file name when creating a tablespace. How can I remove the spaces in the name, next we will remove the experiment. Rename: checks data by changing the tablespace offline, system-level rename, database-level rename, and tablespace online.

1. Create a test table space

Sys @ ORCL> create tablespace aaa datafile '/11g/app/oracle/oradata/ORCL/aaa bbb. dbf' size 10 m;

Tablespace created.

2. offline the tablespace

Sys @ ORCL> alter tablespace aaa offline;

Tablespace altered.

3. An error is returned when you directly modify the data file name.

Sys @ ORCL> alter database rename file '/11g/app/oracle/oradata/ORCL/aaa bbb. dbf 'to'/11g/app/oracle/oradata/ORCL/aaabbb. dbf ';

Alter database rename file '/11g/app/oracle/oradata/ORCL/aaa bbb. dbf' to'/11g/app/oracle/oradata/ORCL/aaabbb. dbf'

*

ERROR at line 1:

ORA-01511: error in renaming log/data files

ORA-01141: error renaming data file 8-new file '/11g/app/oracle/oradata/ORCL/aaabbb. dbf' not

Found

ORA-01110: data file 8: '/11g/app/oracle/oradata/ORCL/aaa bbb. dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

4. Modify the name of the operating system-level data file

[Oracle @ test ORCL] $ mv aaa \ bbb. dbf aaabbb. dbf

[Oracle @ test ORCL] $ ls

Aaabbb. dbf redo01.log SYSAUX01.DBF TEST. DBF wmis01.dbf

Control01.ctl redo02.log SYSTEM01.DBF UNDOTBS01.DBF

EXAMPLE01.DBF redo03.log temptbs01.dbf USERS01.DBF

5. Modify the database-level data file name
Sys @ ORCL> alter database rename file '/11g/app/oracle/oradata/ORCL/aaa bbb. dbf 'to'/11g/app/oracle/oradata/ORCL/aaabbb. dbf ';

Database altered.

6. upload the data file online

Sys @ ORCL> alter tablespace aaa online;

Tablespace altered.

Sys @ ORCL> select name from v $ datafile where file # = 8;

NAME

Bytes ----------------------------------------------------------------------------------------------------

/11g/app/oracle/oradata/ORCL/aaabbb. dbf

Summary: This test mainly involves renaming at the system level and modifying the name at the database level. The following is an example of the error sequence and an error message. Before the production database is changed, it is best to back up the database. DBA is a treasure-saving tool!

This article permanently updates the link address:

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.