Methods of inverted library with different character sets

Source: Internet
Author: User
Tags character set chr commit integer mail

The first step: EXP original US7ASCII database Scott user.
Step Two: EXP original US7ASCII database of Zhaoboyi users.
Step three: CREATE NEW DATABASE (CHARACTER SET simplified Chinese_china. ZHS16GBK),
All the paths with the original
The database is the same.

Step Fourth: Init in the ZHS16GBK. ORA COPY INIT. ORA. Bak.
Step Fifth: Init in the us7ascii. ORA COPY ZHS16GBK Modify the corresponding parameters.
Step sixth: Generate the Scott user in ZHS16GBK, authorize the Scott user in the EXP zhs16gbk.
Step seventh: Generate Zhaoboyi users in ZHS16GBK, Zhaoboyi users in EXP ZHS16GBK.
Step eighth: Use UltraEdit to open (Us7ascii) and (ZHS16GBK) SCOTT users, the first 5 lines of the U
S7ascii different place to get rid of.
Nineth step: The corresponding to do zhaoboyi users.
Tenth step: In ZHS16GBK, execute the owaload of the SYS user. SQL, for HTP. P authorization.
11th Step: Imp, pour the original database into the new database.
The 12th step: Solve large and large segment problem.
First executes the stored procedure Fwrite_clob_niu in the original database, generates the table with large characters into the file, and then
, compile the execution fupdate_clob_text in the new database,
Rewind the large segment back to the new database.
Appendix:
1. Stored procedures: Fwrite--clob--niu
Procedure Fwrite_clob_niu AS
CURSOR C_lt is
SELECT c.text,c.info_id
From Info_ctext C
where info_id <= 120
--change7.16 WHERE info_id <=100
ORDER BY info_id ASC;
/*
1000-1100 F
1100-1600 OK
1600-1630 OK
1629-1640 OK
1640-1660 F
1660-1668 OK
1669 F
1670-1750 OK
*/
Str VARCHAR2 (32767): = Null;
Position INTEGER: = 1;
New_position INTEGER: = 1;
Pat varchar2: = ' D:\writeclob ';
--change716 Pat varchar2: = '/export/home0/ora8i/doc/ch ';
Save_file Utl_file.file_type;
Result BOOLEAN: = FALSE;
Dir_delimiter VARCHAR2 (200): = ' \ ';
--change 7.16 dir_delimiter VARCHAR2 (200): = '/'; --Note:use ' for Win
Dows NT
P_filename VARCHAR2 (200);
V_offset integer;
V_amount integer;
V_buffer varchar2 (30240);
BEGIN
V_amount: = 30240;
IF SUBSTR (PAT, LENGTH (PAT), 1)!= Dir_delimiter THEN
Pat: = Pat | | Dir_delimiter; End IF;
BEGIN
for R in C_lt
LOOP
IF R.text is not NULL then
P_filename: = r.info_id | | '. DAT ';
New_position:=1;
Position:=1;
Save_file: = Utl_file.fopen (Pat, P_filename, ' W ');
If Dbms_lob. INSTR (R.text, CHR (Ten), Position) = 0 Then
Begin
V_offset: = 1;
V_buffer: = ';
Loop

Dbms_lob.read (R.text,v_amount,v_offset,v_buffer);

V_offset: = V_offset + v_amount;
Utl_file.put (Save_file, V_buffer);
--HTP.P (V_buffer);
--HTP.P (' jjjj ');
End Loop;
exception
When No_data_found Then
Null
End

--HTP.P (' 111 ');
--STR: = Dbms_lob. SUBSTR (r.text,1) | | CHR (10);
--HTP. P (STR);
End If;
while (new_position!= 0)
LOOP
New_position: = Dbms_lob. INSTR (R.text, CHR (Ten), Position);

STR: = Dbms_lob. SUBSTR (R.text, new_position-position, Position);
--HTP. P (' str= ');
--HTP. P (STR);
Position: = new_position + 1;

--change 7.17 IF new_position!= 0 THEN
Utl_file.put_line (Save_file, REPLACE (Str, CHR (), Null));
-Else

--Utl_file.put_line (Save_file, STR);
--Change 7.17
--HTP.P (new_position);
--End IF;
End LOOP;
Utl_file. FCLOSE (Save_file);
HTP.P (' <center>End If;
End LOOP;

EXCEPTION
When No_data_found THEN
HTP.P (' <center>End
End Fwrite_clob_niu;
Appendix II: Stored Procedures Fupdate_clob_text
Procedure Fupdate_clob_text AS
CURSOR C_lt is
SELECT c.text,c.info_id
From Info_ctext C
--Where info_id = 112
Where ((info_id >= 1 and info_id <=) or
(info_id >=30 and info_id <=) or
(info_id >=60 and info_id <=) or
(info_id >=90 and info_id <= 120))


/*--change 716 WHERE type not in (' B ', ' C ', ' V ', ' A ', ' E ') and (info_id >=10000
and info_id <20000) or
(info_id >=1100 and info_id <1601) or
(info_id >=1600 and info_id <1630) or
(info_id >=1660 and info_id <1668) or
info_id >=1670 or
(info_id >=0 and info_id <501))
*/
ORDER BY info_id ASC;
/*
1000-1100 F
1100-1600 OK
1600-1630 OK
1629-1640 OK
1640-1660 F
1660-1668 OK
1669 F
1670-1750 OK
*/
TMP CLOB;
Pat varchar2: = ' D:\writeclob ';
--Change 7.16 Pat varchar2: = '/export/home0/ora8i/doc/ch ';
Save_file Utl_file.file_type;
Result BOOLEAN: = FALSE;
Dir_delimiter VARCHAR2 (200): = ' \ ';
--Change 7.16 dir_delimiter VARCHAR2 (200): = '/'; --Note:use ' for W
indows NT
P_filename VARCHAR2 (200);
BEGIN
HTP.P (' we ');

IF SUBSTR (PAT, LENGTH (PAT), 1)!= Dir_delimiter THEN
Pat: = Pat | | Dir_delimiter; End IF;
for R in C_lt
LOOP
Begin
P_filename: =to_char (r.info_id) | | DAT ';
UPDATE info_ctext SET Text = '
WHERE info_id=r.info_id;
COMMIT;

SELECT text into TMP from Info_ctext
WHERE info_id = r.info_id for UPDATE;


--Dbms_lob. TRIM (TMP, 0);

Result: = Load_file (Pat, P_filename, TMP);

IF result THEN
UPDATE info_ctext SET Text = Tmp
WHERE info_id=r.info_id;
COMMIT;
End IF;

End
End LOOP;
EXCEPTION
When No_data_found THEN
HTP.P (' <center>

End Fupdate_clob_text;
Appendix III: New Database Character Set
Nls--lang
Simplified Chinese_china. Zhs16gbk
Original database Character Set
American_america. Us7ascii.


______________________________________

===================================================================
Sina free e-mail (http://mail.sina.com.cn)
Subscribe to mobile phone SMS Headline news, every day award a variety of fashionable mobile phones! (http://dailynews.sina.com.cn/c/272235.html)
Subscribe to mobile phone message top news daily new mobile phone awards! (http://dailynews.sina.com.cn/c/266499.html)




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.