Preliminary Discussion on Character Set Problem (Seven) ---- Internal Operation of Character Set Change

xiaoxiao2021-03-06  107

Original link:

http://www.eygle.com/special/nls_character_set_07.htm

As we mentioned earlier, changing the character set by modifying the PrOPS $ is an extremely dangerous way, should try to avoid it. We also know that change the character set through the Alter Database Character Set Although it is safe and reliable, there are strict subsets and super-collection constraints, in fact, we can actually use this method. In fact, Oracle still has another way to change the character set. If you pay attention, in Oracle's alert .Log file, you may have seen such log information:

Alter Database Character Set Internal_Convert ZHS16GBK

Updating character set in controlfile to zhs16gbk

Sys.snap $ (rel_Query) - Clob Repesentation Altered

Sys.MetastyleSheet (Stylesheet) - Clob Repesentation Altered

Sys.External_Tab $ (param_clob) - Clob Repesenation Altered

XDB.XDB $ Resource (SYS_NC00027 $) - Clob Repesentation Altered

Odm.odm_pmml_dtd (dtd) - Clob Repesentation Altered

OE.warehouses (sys_nc00003 $) - Clob Repesentation Altered

PM.Online_Media (SYS_NC00042 $) - Clob Representation Altered

PM.Online_Media (SYS_NC00062 $) - Clob Repesentation Altered

PM.Online_Media (Product_Text) - Clob Repesentation Altered

PM.Online_Media (SYS_NC00080 $) - Clob Repesentation Altered

PM.Print_Media (ad_sourcetext) - Clob Representation Altered

PM.Print_Media (ad_finaltext) - Clob Representation Altered

Completed: Alter Database Character Set Internal_Convert ZHS1

In this, we see such an important, Oracle non-public command:

Alter Database Character Set Internal_Convert / Internal_Use ZHS16GBK

This command is when you choose to create a seed database using a typical manner, Oracle will change the character set of the current seed database to the expected character set according to the character set settings you selected, which is the role of this command.

When using this command, Oracle will skip all subset and supercharges, forced conversion between any character set, so you must be very careful when using this command, you must know this action will bring Risk. The content we have told before is still valid. You can use CSSCAN to scan the entire database. If you confirm that there is no serious data corruption between the converted character set, or you can use this way, you can use this way To convert. Let's take a look at the specific operation process and Oracle internal operation:

This information is recorded alert.log file: Tue Oct 19 16:26:30 2004Database Characterset is ZHS16GBKreplication_dependency_tracking turned off (no async multimaster replication found) Completed: ALTER DATABASE OPENTue Oct 19 16:27:07 2004alter database character set INTERNAL_USE ZHS16CGB231280Updating Character set in controlfile to zhs16cgb231280tue oct 19:27:15 2004thread 1 advanced to log sequence 118 current log # 2 seq # 118 mem # 0: /opt/oracle/oradata/primary/redo02.logtue Oct 19:27:15 2004ARC0: Evaluating archive log 3 thread 1 sequence 117ARC0: Beginning to archive log 3 thread 1 sequence 117Creating archive destination LOG_ARCHIVE_DEST_1: '/opt/oracle/oradata/primary/archive/1_117.dbf'ARC0: Completed archiving log 3 thread 1 sequence 117Tue Oct 19 16:27:20 2004Completed: alter database character set INTERNAL_USE ZHS16CGB231280Shutting down instance: further logons disabledShutting down instance (immediate) License high water mark = 1Tue Oct 19 16:29:06 2004ALTER DATABASE CLOSE NORMAL ...... format Chemize 1 0046 Track files to get the following information (summary):

Alter Session Set Events '10046 Trace Name Context Forever, Level 12'

Alter Database Character Set Internal_Use zhs16cgb231280

Call Count CPU Elapsed Disk Query Current Rows

------------ ----------------------------------- - --------------------

PARSE 1 0.00 0.00 0 0 0 0

Execute 1 4.88 6.04 910 16825 18099 0

FETCH 0 0.00 0.00 0 0 0 0

------------ ----------------------------------- - --------------------

Total 2 4.88 6.04 910 16825 18099 0

Misses in Library Cache During Parse: 1Optimizer Goal: Choose

Parsing User ID: SYS

ELAPSED TIMES INCLUDE WAITING ON FOLLOWING Events:

Event waited on times max. Wait Total Waited

--------------------------------------- - ----------------

Control File Sequential READ 4 0.00 0.00

Control File Parallel Write 2 0.05 0.08

Log File Sync 2 0.08 0.08

SQL * Net Message to Client 1 0.00 0.00

SQL * Net Message from Cliant 1 18.06 18.06

*********************************************************** *****************************

....

Update COL $ set charsetid =: 1

WHERE

Charsetform =: 2

....

Update Argument $ set charsetid =: 1

WHERE

Charsetform =: 2

....

Update Collection $ SET CharsetId =: 1

WHERE

Charsetform =: 2

....

Update Attribute $ set charsetid =: 1

WHERE

Charsetform =: 2

....

Update Parameter $ set charsetid =: 1

WHERE

Charsetform =: 2

....

Update Result $ set charsetid =: 1

WHERE

Charsetform =: 2

....

Update partcol $ set spare1 =: 1

WHERE

Charsetform =: 2

....

Update SubpartCOL $ SET SPARE1 =: 1

WHERE

Charsetform =: 2

....

Update Props $ SET VALUE $ =: 1

WHERE

Name =: 2

....

Update "sys". "KOTAD $" set sys_nc_rowinfo $ =: 1

WHERE

SYS_NC_OID $ =: 2

....

Update SEQ $ SET INCREMENT $ =: 2, minvalue =: 3, maxvalue =: 4, cycle # =: 5, Order $ =: 6,

Cache =: 7, highwater =: 8, Audit $ =: 9, Flags =: 10

WHERE

Obj # =: 1

....

Update kopm $ set metadata =: 1, length =: 2

WHERE

Name = 'db_fdo'

....

ALTER DATABASE CLOSE NORMAL

The logs generated here You can download (for reference): http://www.eygle.com/special/primary_ora_13730.ziphtp://www.eygle.com/special/primary_ora_13730.tkf.log We see this The process and the internal process of the ALTER DATABASE Character set is exactly the same, that is, the help provided by INTERNAL_USE is to make the Oracle database bypass the subset and superchard. This method is useful in some respects , Such as testing; everyone should be particularly careful, except for you, no one will lead the consequences of this: Conclusion (Let's talk again): For DBA, there is a very important principle to: don't Place your database in a dangerous situation! This requires us to do a valid backup before performing any operations that may change the database structure, and many DBA has a painful lesson in the operation of the backup. Author: eygle, Oracle technology followers, Oracle technical forum itpub.www.eygle.com from China is the biggest author's personal site you may contact the author by Guoqiang.Gai@gmail.com welcome to explore technical exchanges and links. exchange.

Original version: http://www.eygle.com/special/nls_character_set_07.htm

转载请注明原文地址:https://www.9cbs.com/read-103825.html

New Post(0)