Rac ORA-001157 data file mistakenly creates local disk shared storage ASM cannot identify/lock data file
Mistakenly create the data file on the local disk instead of shared storage
Cause of error:
Data files that are not in shared storage and cannot be accessed by other instances
Ideas and solutions:
Move local data files to shared storage.
Steps
1. Offline tablespace or data file
two。 Copy data file
3. Rename data file
4. Restore data files (tablespaces are not used)
5. Online tablespaces or data files
Replication scheme
1. RMAN copy datafile
2. Dbms_file_transfer.copy_file
3. ASMCMD cp
Detailed steps:
One:
Alter tablespace ts1 offline
Rman > copy datafile 'local directory / source data file' to 'shared directory / target file name;-- the target file name itself
Alter database rename file 'local directory / source data file' to 'shared directory / destination file name'
Alter tablespace ts1 online
Two:
Create directory source_dir as' local directory /'
Create directory dest_dir as' shared directory /'
Alter tablespace ts1 offline
Begin
Dbms_file_transfer.copy_file ('SOURCE_DIR',' source data file name', 'DEST_DIR',' target file name')
End
-- you can confirm whether the copy is correct and successful through the asmcmd command line
/ *
Grid > asmcmd
Asmcmd > cd shared directory
Asmcmd > ls target file name
, /
Alter database rename file 'local directory / source data file name' to 'shared directory / destination file name'
Alter tablespace ts1 online
Three:-- to operate data files, it can only be feasible for tablespaces to add data files, and there is an error in creating tablespaces (the following is changed to tablespaces)
Alter database datafile 'local directory / source data file' offline
Root > mv source data file / home/grid/
Root > chown grid:asmadmin source data file-/ home/grid/ directory operation
Grid > asmcmd
Asmcmd > cd shared directory
Asmcmd > cp / home/grid/ source data file destination file name
Asmcmd > ls
Alter database rename file 'local directory / source data file' to 'shared directory / destination file name'
Alter database recover datafile 'shared directory / destination file name'
Alter database datafile 'shared directory / target file name' online