New feature of specifying a character set for a control file.
Control file Character Set
The `CREATE CONTROLFILE` command can still be used to specify a character set for a control file in Oracle.
However, it is no longer the recommended way to do this.
The `CREATE CONTROLFILE` command was introduced in Oracle Database 8i. At that time, it was the only way to specify a character set for a control file. However, in Oracle Database 10g, the `ALTER CONTROLFILE` command was introduced. This command allows you to change the character set of an existing control file.
It is recommended that you use the `ALTER CONTROLFILE` command to change the character set of a control file, rather than the `CREATE CONTROLFILE` command. This is because the `ALTER CONTROLFILE` command is less likely to cause problems with existing backups and restores. Here is an example of how to use the `ALTER CONTROLFILE` command to change the character set of a control file:
ALTER CONTROLFILE SET CHARACTER SET = AL32UTF8;
This command will change the character set of the control file to AL32UTF8. This is the recommended character set for control files.
For more information on the `CREATE CONTROLFILE` and `ALTER CONTROLFILE` commands, please refer to the Oracle Database Backup and Recovery User's Guide.
Specifying a Character Set for a Control File
Describe the new feature of specifying a character set for a control file.
Starting with Oracle version 8.0.5, the database character set ID is stored within a control file. This allows access to the database character set before opening the database. This is necessary for the Recovery Manager to correctly interpret tablespace names prior to the database being open when the character set happens to be something other than the default (US7ASCII).
The CREATE CONTROLFILE syntax has been expanded to optionally accept the database character set name, so that the character set information is available at mount time. The information becomes available from the control file, before the database is open, for any subsequent recovery attempts. If the control file is lost, recovery is still possible. The DBA may specify the character set as an argument on the CREATECONTROL FILE statement.
The following series of images explains the steps needed to change the character set of a control file by using RMAN.
Changing Character Sets
The syntax for re-creating a control file is:
CREATE CONTROLFILE REUSE
DATABASE <database name>
LOGFILE <log file details along with its group>
NORESETLOGS / RESETLOGS
DATAFILE <datafile name(s)>
MAXLOGFILES <integer value>
MAXLOGHISTORY < integer value >
MAXDATAFILES < integer value >
MAXINSTANCES < integer value >
ARCHIVELOG / NOARCHIVELOG
CHARACTER SET <character set code>;
Here is an example of creating a control file with database ORDERS_2 that was created with the F7DEC character set.
CREATE CONTROLFILE REUSE
DATABASE orders_2
LOGFILE GROUP 1 ('diskb:log1.log',
'diskc:log1.log') SIZE 50K,
GROUP 2 ('diskb:log2.log',
'diskc:log2.log') SIZE 50K
NORESETLOGS
DATAFILE 'diska:dbone.dat' SIZE 2M
MAXLOGFILES 5
MAXLOGHISTORY 100
MAXDATAFILES 10
MAXINSTANCES 2
ARCHIVELOG
CHARACTER SET F7DEC;
The next lesson explains how to recover a database by using the line mode of RMAN.