Beruflich Dokumente
Kultur Dokumente
Rui Wang
To implement upgrade of one of our applications, our team scheduled a period of downtime to get
oracle database (10.2.0.4)ready for it. What the DBA team is required is to create a new oracle
database which is identical to the production database. Thanks for the downtime of production
database, the steps to create identical database are quite straightforward as below.
before downtime
• extract “create controlfile” command from trace file under folder udump
• edit command to reflect new location of target database, and change line of
• create init parameter file, password file and edit listener.ora and tnsnames.ora
Once the target database is up, we are ready to implement character set conversion. The following
• Installing and configuring Csscan in 10g and 11g (Database Character Set Scanner)
[ID 745809.1]
The first thing to install CSSCAN is to connect database as sysdba and run script csminst.sql
($ORACLE_HOME/rdbms/admin).
please ignore it because granting read privilege to these two directories is removed.
And then, we need to make sure if CSSCAN is installed propermanticsly and ready for use. To
If we have “Scanner terminated successfully.” message, we are ready to use CSSCAN for
database.
• Invalid objects
Note that, please log on database with sysdba to proceed the followign steps.
1) Invalid objects
To check invalid objects in database, we need to Issue the following sql statement to check
invalid objects
SQL> select distinct owner from dba_objects where status=’INVALID’;
The above sql statement lists all of schemas which contains ‘INVALID’ objects. These invalid objects
need to be compiled or dropped if they are unused. The simplest way to compile all of objects
o.owner||'.'||object_name "OWNER.OBJECT"
If “no rows selected”, please go proceed next step. Otherwise, check Note: 336014.1 How To
by 1,2;
This will remove unneeded objects and otherwise during CSALTER an ORA-38301 will be seen.
order by 1;
If “no rows selected”, please go proceed next step. Otherwise, check Note: 4157602.8
Where, ‘WE8ISO8859P1’ is the current character set of database. To check current character set of
parameter='NLS_CHARACTERSET';
3. dbcheck.err contains the rowid's of the Lossy rows reported in dbcheck.txt (if any).
This is to check if all data is stored correctly in the current character set. Because the TOCHAR and
FROMCHAR character sets as the same there cannot be any "Convertible" or "Truncation" data
reported in dbcheck.txt. If all the data in the database is stored correctly at the moment then there
If there is any "Lossy" data then those rows contain code points that are not currently defined
correctly and they should be cleared up before you can continue. The most common situation is
when having an US7ASCII/WE8ISO8859P1 database and "Lossy", in this case changing your
After conversion to WE8MSWIN1252, repeat above CSSCAN command to make sure there is no “lossy”
data.
Step 4. Check for "Convertible" and "Truncation" data when going to UTF8
ARRAY=1000000 PROCESS=2
toutf8.err contains the rowid's of the Convertible and Lossy rows reported in toutf8.txt
There should be NO entries under "Lossy" in toutf8.txt, because they should have been filtered out
[Scan Summary]
All character type data in the data dictionary are convertible to the new character set
All character type application data remain the same in the new character set
[Data Dictionary Conversion Summary]
VARCHAR2 4,225,489 0 0 0
CHAR 1,116 0 0 0
LONG 159,629 0 0 0
VARRAY 23,462 0 0 0
The data dictionary can be safely migrated using the CSALTER script
VARCHAR2 5,262,627 0 0 0
CHAR 87 0 0 0
LONG 0 0 0 0
CLOB 134 0 0 0
VARRAY 1,587 0 0 0
Total 5,264,435 0 0 0
In above toutf8.txt, there are detailed list of application objects which we need to use
MDSYS.SDO_COORD_OP_PARAM_VALS 200 0 0
MDSYS.SDO_GEOR_XMLSCHEMA_TABLE 1 0 0
MDSYS.SDO_STYLES_TABLE 78 0 0
MDSYS.SDO_XML_SCHEMAS 4 0 0
SYS.METASTYLESHEET 80 0 0
SYS.RULE$ 4 0 0
SYS.SQL$TEXT 1 0 0
SYS.WRH$_SQLTEXT 1,420 0 0
SYS.WRH$_SQL_PLAN 1,339 0 0
SYS.WRI$_ADV_ACTIONS 4,754 0 0
SYS.WRI$_ADV_OBJECTS 2,872 0 0
SYS.WRI$_ADV_RATIONALE 2,130 0 0
SYS.WRI$_DBU_FEATURE_METADATA 99 0 0
SYS.WRI$_DBU_FEATURE_USAGE 10 0 0
SYS.WRI$_DBU_HWM_METADATA 19 0 0
WEBCT.AGN_ASSIGNMENT 4,130 0 0
WEBCT.AGN_GROUPASSIGNMENT 221 0 0
WEBCT.AGN_SUBMISSION 12,531 0 0
WEBCT.AGN_SUBMISSION_COMMENT 594 0 0
WEBCT.ANNOUNCEMENT 1,776 0 0
WEBCT.ASSMT_ATTEMPT 144 0 0
WEBCT.ASSMT_ATTEMPT_ITEM 4,386 0 0
WEBCT.ASSMT_RESPONSE 3,264 0 0
WEBCT.ASSMT_SETTING 24 0 0
WEBCT.CALENDAR_ENTRY 4,634 0 0
WEBCT.CMS_CE_LANGUAGE 2 0 0
WEBCT.CMS_CONTENT_ENTRY 586,378 0 0
WEBCT.CMS_LINK 653 0 0
WEBCT.CMS_UNIQUE_NAME 618 0 0
WEBCT.CMS_UNIQUE_NAME070809133755 218 0 0
WEBCT.CO_HEADERFOOTER 11,479 0 0
Please note that only data dictionary and oracle schema could be safely converted to target
character set. Other application data, such as objects in schema WEBCT, need to be converted by
using export/import mechanism. The basic step is to do object export backup, drop objects and
Export these application objects and then drop them from database. Please note that “Do NOT use
Expdp/Impdp when going to (AL32)UTF8 or an other multibyte characterset on ALL 10g versions
After all of application objects/data are dropped from database, please re-run csscan
command in step 4 to check if there is application object/data in toutf8.txt. If not, it’s ready
Database closed.
Database dismounted.
Database mounted.
Database opened.
SQL> $ORACLE_HOME/rdbms/admin/csalter.plb
0 rows created.
Function created.
Function created.
Procedure created.
This script will update the content of the Oracle Data Dictionary.
Please ensure you have a full backup before initiating this procedure.
0 rows deleted.
Function dropped.
Function dropped.
Procedure dropped.
VALUE$
--------------------------------------------------------------------------------
UTF8
While you start the importing job, you’ll find the screen output as following.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
It’s clear that importing application object/data will automatically finish character set
conversion.
conversion is done completely. To be safe, it’s highly recommended to compare all of related
schemas between source database and target database to make sure that there is no object is
our application database. The above steps may not apply to other database or application.
If you find it’s helpful, that’s great. If you have any concern, please refer to related