[Translated from mos] use the asmcmd cp command to move the datafile from the file system to the asm disk group-for 11gR2, asmcmd11gr2

Source: Internet
Author: User

[Translated from mos] use the asmcmd cp command to move the datafile from the file system to the asm disk group-for 11gR2, asmcmd11gr2

Use the asmcmd cp command to move the datafile from the file system to the asm disk group-for 11gR2

Reference Original:
How to Move a Datafile from Filesystem to ASM Using asmcmd cp Command. (Doc ID 1610615.1)

Applicable:
Oracle Database-Enterprise Edition-Version 11.2.0.1 to 11.2.0.4 [Release 11.2]
Information in this document applies to any platform.


Symptoms:
Datafile is incorrectly added to the file system and should be placed in the asm disk group.

Cause:
This is not a datafile of the system tablespace.

Solution:

1. Make the datafile offline
SQL> alter system switch logfile;
System altered.
SQL> select file_name, file_id from dba_data_files;
FILE_NAME FILE_ID
---------------------
/U01/oracle/oradata/test1.dbf 6

SQL> alter database datafile 6 offline;
Database altered.
SQL> select file_name, file_id, online_status from dba_data_files where file_id = 6;
FILE_NAME FILE_ID ONLINE_STATUS
-----------------
/U01/oracle/oradata/test1.dbf 6 RECOVER


2. Run the asmcmd command to copy the file from the file system to the asm disk group.
ASMCMD> cp/u01/oracle/oradata/test1.dbf + DATA/LONDON/DATAFILE/test. dbf
Copying/u01/oracle/oradata/test1.dbf-> + DATA/LONDON/DATAFILE/test. dbf

ASMCMD> ls-lt
Type Redund Striped Time Sys Name
N test. dbf => + DATA/ASM/DATAFILE/test. dbf.286.833718815
ASMCMD> pwd
+ DATA/ASM/DATAFILE

3. Once the datafile is copied, rename the datafile.
SQL> alter database rename file '/u01/oracle/oradata/test1.dbf' to '+ DATA/LONDON/DATAFILE/test. dbf ';
Database altered.

4. recover the datafile and onlime the datafile
SQL> alter database recover datafile 6;
Database altered.

SQL> alter database datafile 6 online;
Database altered.


5. Confirm the correct file name and Path

SQL> select file_name, file_id, online_status from dba_data_files where file_id = 6;
FILE_NAME FILE_ID ONLINE_STATUS
-----------------
+ DATA/london/datafile/test. dbf 6 ONLINE


Role of the ASM command in linux

Oracle 10R2 releases the asmcmd tool to manage files stored in asm.
1. To use the asmcmd command, you must first start the asm instance. Otherwise, the following error occurs: rac2-> asmcmd-p
A ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory (dbd error: OCISessionBegin) 2. when using asmcmd, you must specify ORACLE_HOME and ORACLE_SID. Note that ORACLE_SID is the sid of asm. Otherwise, the following error occurs: rac2-> asmcmd-p.
A ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory (dbd error: OCISessionBegin) 3. The asmcmd command has the following functions:
With p, asmcmd will display the current path: rac2-> asmcmd-p
ASMCMD [+]> ls
DG1/
RECOVERDEST/
ASMCMD [+]> cd DG1
ASMCMD [+ DG1]> ls
DEVDB/
ASMCMD [+ DG1]> cd DEVDB
ASMCMD [+ DG1/DEVDB]> without p, the current path is not displayed: rac2-> asmcmd
ASMCMD> ls
DG1/
RECOVERDEST/
ASMCMD> cd DG1
ASMCMD> ls
DEVDB/
ASMCMD> cd DEVDB
ASMCMD> 4. For other related parameters, use help to view ASMCMD [+]> help
Asmcmd [-p] [command]

The environment variables ORACLE_HOME and ORACLE_SID determine
Instance to which the program connects, and ASMCMD establishes
Bequeath connection to it, in the same manner as a SQLPLUS/
SYSDBA. The user must be a member of the SYSDBA group.

Specifying the-p option allows the current directory to be displayed
In the command prompt, like so:

ASMCMD [+ DATAFILE/ORCL/CONTROLFILE]>

[Command] specifies one of the following commands, along with its
Parameters.

Type "h... the remaining full text>
 
How can I run the asm Program directly using the cmd command without the masm software ??

.Asmis the source code and is a pure file. You need to use masm.exeto compile the file into an intermediate file, and then use link.exe to link the intermediate file to the target file (*. exe) for running.

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.