You Asked
Hi tom,
i've run into an issue out of the ordinary.
while adding datafile to an existing tablespace we had fews trailing characters inbedded (by mistake) at the end of the .dbf extension.
We have dbvisit replication broken due to this since it can't replicate the ddl with special characters.
we've manage to get the exact command type by the admin in the alertlog:
alter tablespace SCI_DATA add datafile '/home/oracle/oradata/ORCLPRD/Datafiles/SCI_DATA02.dbf''^[[C^[' size 1G autoextend on next 512M
Completed: alter tablespace SCI_DATA add datafile '/home/oracle/oradata/ORCLPRD/Datafiles/SCI_DATA02.dbf''^[[C^[' size 1G autoextend on next 512M
is their a way to inteprete the character being typed after the .dbf so that we can do a rename. (probably some space and backspace typed in
-> Notice the ' after the .dbf
SQL> select * from dba_data_files where file_ID=10;
FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS ONLINE_
---------- ------------------------------ ---------- ---------- --------- ------------ --- ---------- ---------- ------------ ---------- ----------- -------
/home/oracle/oradata/ORCLPRD/Datafiles/SCI_DATA02.dbf'
0 SCI_DATA 1.7717E+10 2162688 AVAILABLE 10 YES 3.4360E+10 4194302 65536 1.7716E+10 2162560 ONLINE
SQL> select dump(file_name) from dba_data_files where file_name like '%/home/oracle/oradata/ORCLPRD/Datafiles/SCI_DATA02.dbf%';
DUMP(FILE_NAME)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Typ=1 Len=58: 47,104,111,109,101,47,111,114,97,99,108,101,47,111,114,97,100,97,116,97,47,79,82,67,76,80,82,68,47,68,97,116,97,102,105,108,101,115,47,83,67,73,95,68,65,84,65,48,50,46,100,98,102,39,27,91,67,27
SQL> select chr(46),chr(100),chr(98),chr(102),chr(39),chr(27),chr(91),chr(67),chr(27) from dual;
C C C C C C C C C
- - - - - - - - -
. d b f ' C
Client doesn't want to create a new tablespace and move the data since he can't afford downtime more than 1 hours (here at least 70Go of data)
-> I believe recreation of control file might be too risky
-> The use of pl/sql to store the name in a variable and use it in the alter database rename command failed too.
i was betting on a last solution which would be through the mean of RMAN.
RMAN> REPORT SCHEMA;
RMAN> SQL 'ALTER TABLESPACE SCI_DATA OFFLINE';
RMAN> COPY DATAFILE 10 TO '/home/oracle/oradata/ORCLPRD/Datafiles/SCI_DATA03.dbf';
RMAN> SWITCH DATAFILE 10 TO COPY;
RMAN> RECOVER TABLESPACE SCI_DATA;
RMAN> SQL 'ALTER TABLESPACE SCI_DATA ONLINE';
RMAN> HOST 'rm /home/oracle/oradata/ORCLPRD/Datafiles/SCI_DATA02*';
Thnks for your help & advise?
Regards,
Atish
and Connor said...
So I did this:
create tablespace BLAH
datafile 'C:\ORACLE\ORADATA\DB122\BLAHßßß.DBF' size 10m;
I can derive the characters with a little SQL, eg
SQL> select ascii(substr(name,i,1))
2 from ( select name from v$datafile where name like '%BLAH%' ),
3 ( select rownum i from dual connect by level <= 35 );
ASCII(SUBSTR(NAME,I,1))
-----------------------
67
58
92
79
82
65
67
76
69
92
79
82
65
68
65
84
65
92
68
66
49
50
50
92
66
76
65
72
50079
50079
50079
46
68
66
70
so I can build up the rename I need..
alter tablespace blah offline;
--
-- then rename it at OS level, and then build the rename command
--
set serveroutput on
declare
fname1 varchar2(100);
fname2 varchar2(100);
begin
select name into fname1 from v$datafile where file# = 9;
fname2 := replace(fname1,chr(50079));
dbms_output.put_line('alter database rename file '''||fname1||''' to '''||fname2||'''');
execute immediate 'alter database rename file '''||fname1||''' to '''||fname2||'''';
end;
/
alter tablespace blah online;
SQL> select name
2 from v$datafile
3 where file# = 9;
NAME
-------------------------------------
C:\ORACLE\ORADATA\DB122\BLAH.DBF
and we're done
Rating
(2 ratings)
Is this answer out of date? If it is, please let us know via a Comment