04.10.2006 16:04
Для начала помним, какую глубокую мысль до нас несли древние египтяне... Забэкапить все хорошенько... Чтобы народ не мучился, взялся тут за переименование базы через nid. Раньше просто через перестроение контрольников. Вот, полюбуйтесь. Озвучьте замечания, кто делал :) Кто не делал - примите к сведению.

C:\Documents and Settings\OlegON>set oracle_sid=test

C:\Documents and Settings\OlegON>set nls_lang=american_america.cl8mswin1251

C:\Documents and Settings\OlegON>sqlplus /nolog

SQL*Plus: Release 9.2.0.7.0 - Production on Wed Oct 4 14:43:40 2006

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

SQL> connect sys/qqq as sysdba
Connected.
SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area 93396636 bytes
Fixed Size 454300 bytes
Variable Size 58720256 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
C:\Documents and Settings\OlegON>nid target=sys/qqq@test dbname=olegon
DBNEWID: Release 9.2.0.7.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

Connected to database TEST (DBID=1892035925)

Control Files in database:
C:\ORACLE\ORADATA\TEST\CONTROL01.CTL
C:\ORACLE\ORADATA\TEST\CONTROL02.CTL
C:\ORACLE\ORADATA\TEST\CONTROL03.CTL

Change database ID and database name TEST to OLEGON? (Y/[N]) => y

Proceeding with operation
Changing database ID from 1892035925 to 3962210345
Changing database name from TEST to OLEGON
Control File C:\ORACLE\ORADATA\TEST\CONTROL01.CTL - modified
Control File C:\ORACLE\ORADATA\TEST\CONTROL02.CTL - modified
Control File C:\ORACLE\ORADATA\TEST\CONTROL03.CTL - modified
Datafile C:\ORACLE\ORADATA\TEST\SYSTEM01.DBF - dbid changed, wrote new name
Datafile C:\ORACLE\ORADATA\TEST\UNDOTBS01.DBF - dbid changed, wrote new name
Datafile C:\ORACLE\ORADATA\TEST\INDX01.DBF - dbid changed, wrote new name
Datafile C:\ORACLE\ORADATA\TEST\TOOLS01.DBF - dbid changed, wrote new name
Datafile C:\ORACLE\ORADATA\TEST\USERS01.DBF - dbid changed, wrote new name
Datafile C:\ORACLE\ORADATA\TEST\TEMP01.DBF - dbid changed, wrote new name
Control File C:\ORACLE\ORADATA\TEST\CONTROL01.CTL - dbid changed, wrote new name
Control File C:\ORACLE\ORADATA\TEST\CONTROL02.CTL - dbid changed, wrote new name
Control File C:\ORACLE\ORADATA\TEST\CONTROL03.CTL - dbid changed, wrote new name

Database name changed to OLEGON.
Modify parameter file and generate a new password file before restarting.
Database ID for database OLEGON changed to 3962210345.
All previous backups and archived redo logs for this database are unusable.
Shut down database and open with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

C:\Documents and Settings\OlegON>cd C:\oracle\ora92\database\

C:\oracle\ora92\database>orapwd file=pwdolegon.ora password=qqq

Смена имени в tnsnames.ora

C:\oracle\ora92\database>oradim -delete -sid test

В C:\oracle\admin\TEST\pfile\init.ora замена всех вхождений TEST на OLEGON
Как правило, у init в имени цифровой постфикс, его проще стереть
C:\oracle\admin\TEST переименовывается в C:\oracle\admin\olegon

C:\oracle\ora92\database>oradim -new -sid olegon -startmode a

C:\oracle\ora92\database>set oracle_sid=olegon

C:\oracle\ora92\database>sqlplus /nolog

SQL*Plus: Release 9.2.0.7.0 - Production on Wed Oct 4 15:33:29 2006

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

SQL> connect sys/qqq as sysdba
Connected to an idle instance.

C:\oracle\oradata\TEST переименовать в C:\oracle\oradata\olegon

SQL> startup pfile='C:\oracle\admin\olegon\pfile\init.ora'
ORACLE instance started.

Total System Global Area 93396636 bytes
Fixed Size 454300 bytes
Variable Size 58720256 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

Запускаем Редактор и переименовываем файлики самой базы.
Можно сделать это и вручную через alter database rename file 'old_name' to 'new_name';

SQL> alter database open resetlogs;

Database altered.

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> create spfile from pfile='C:\oracle\admin\olegon\pfile\init.ora';

File created.

SQL>

Работаем дальше...
Часовой пояс GMT +3, время: 23:54.

Форум на базе vBulletin®
Copyright © Jelsoft Enterprises Ltd.
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.