oracle GBK未定义编码使用Unicode写入特殊字符e000迁移lightdb-x测试

news2024/11/29 5:31:41

E:\HS\LightDBSVN\23.3sql文件\迁移工具\caofa\config\application.properties

gbk-->uft8:

logging.config=classpath:log4j2.xml
# ????
etl.global.sourceDatabase=oracle
etl.global.targetDatabase=lightdb
etl.global.showSql=false
etl.global.fastFail=false
etl.global.enableWithDoubleQuote=false
etl.global.package.onlyKeepType=true
etl.global.transferSchemas=hr
etl.global.enableFunctions=TransferTable,TransferTableData,TableCompare,TableDataCompare,TransferIndex,TransferSequence,TransferView,TransferTrigger,TransferPackage,TransferProcedure,TransferFunction


#gbk

etl.source.jdbc.url=jdbc:oracle:thin:@10.20.30.199:1521/gbk
etl.source.jdbc.username=test
etl.source.jdbc.password=test

# utf8
etl.target.jdbc.url=jdbc:postgresql://10.19.69.252:5432/etlu2
etl.target.jdbc.username=lightdb
etl.target.jdbc.password=lightdb123
-- 创建表  
drop TABLE hr.gbk2;
CREATE  TABLE hr.gbk2 (  
  id NUMBER PRIMARY KEY,  
  data VARCHAR2(4000)  
);  

INSERT INTO hr.gbk2 (id, data) VALUES (1, 'fhsjdhfjs看到回國的飛機共和黨國會');
INSERT INTO hr.gbk2 (id, data) VALUES (2, '付款的官方的理工科              ');
INSERT INTO hr.gbk2 (id, data) VALUES (3, '看來是價格                      ');
INSERT INTO hr.gbk2 (id, data) VALUES (4, '快攻打法瞭解更多                ');
INSERT INTO hr.gbk2 (id, data) VALUES (5, '84375jkdgkfckvkb堅不可摧v       ');
INSERT INTO hr.gbk2 (id, data) VALUES (6, ';報價參考報價下                ');
INSERT INTO hr.gbk2 (id, data) VALUES (7, '老闆超級不開心                  ');
INSERT INTO hr.gbk2 (id, data) VALUES (8, '了從包括v菠蘿快車v了            ');
INSERT INTO hr.gbk2 (id, data) VALUES (9, '从离开滨江屡见不鲜              ');
INSERT INTO hr.gbk2 (id, data) VALUES (10, '查看背景下来不及  差旅不可撤销吧');
INSERT INTO hr.gbk2 (id, data) VALUES (11, 'clvjbxj   ');
INSERT INTO hr.gbk2 (id, data) VALUES (12, '了出现崩溃');
INSERT INTO hr.gbk2 (id, data) VALUES (13, '查看下礼拜');
commit;

select * from hr.gbk2;

插入自定义字符:

# 通过unicode插入不存在gbk
unicode_char4 = u'\ue000'
insert_sql = """  
    INSERT INTO hr.gbk2 (id, data)  
    VALUES (:id1,:value)  
"""
cursor.execute(insert_sql, {'id1':36,'value': unicode_char4})
cursor.execute(insert_sql, {'id1':37,'value': unicode_char4})

迁移后查看lightdb-x:

lightdb@etlu2=# drop table hr.gbk2;
DROP TABLE
lightdb@etlu2=# select * from hr.gbk2;
ERROR:  relation "hr.gbk2" does not exist
LINE 1: select * from hr.gbk2;
                      ^
lightdb@etlu2=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
 36 | 
(15 rows)

lightdb@etlu2=# show server_encoding ;
 server_encoding 
-----------------
 UTF8
(1 row)

lightdb@etlu2=# 

2023-09-27 17:50:38.276 [main] INFO  com.hundsun.lightdb.core.EtlDirector - 表结构对比开始
2023-09-27 17:50:38.277 [main] INFO  com.hundsun.lightdb.core.EtlDirector - hr.countries对比一致。hr.regions对比一致。hr.gbk2对比一致。hr.gbktest对比一致。

数据比对一致:

2023-09-27 17:50:38.795 [main] INFO  com.hundsun.lightdb.core.EtlDirector - 数据对比开始
regions对比一致。countries对比一致。job_history对比一致。locations对比一致。gbk2对比一致。jobs对比一致。employees对比一致。departments对比一致。

gbk--->gbk:数据迁移报错

[lightdb@lightdb1 lightdb-x-13.8-23.3-14917-el7.x86_64]$ /data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5444
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                              List of databases
   Name    |  Owner  | Encoding |  Collate  |   Ctype   |  Access privileges  
-----------+---------+----------+-----------+-----------+---------------------
 etl       | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =Tc/lightdb        +
           |         |          |           |           | lightdb=CTc/lightdb+
           |         |          |           |           | etl=CTc/lightdb
 etl_gbk   | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =Tc/lightdb        +
           |         |          |           |           | lightdb=CTc/lightdb+
           |         |          |           |           | etl_gbk=CTc/lightdb
 lt_test   | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | 
 postgres  | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | 
 template0 | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =c/lightdb         +
           |         |          |           |           | lightdb=CTc/lightdb
 template1 | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =c/lightdb         +
           |         |          |           |           | lightdb=CTc/lightdb
(6 rows)

lightdb@postgres=# \c etl_gbk;
You are now connected to database "etl_gbk" as user "lightdb".
compatible type: oracle
lightdb@etl_gbk=# show server_encoding ;
 server_encoding 
-----------------
 GBK
(1 row)

lightdb@etl_gbk=# 

修改迁移工具配置:

# gbk
etl.target.jdbc.url=jdbc:postgresql://10.19.69.252:5444/etl_gbk
etl.target.jdbc.username=lightdb
etl.target.jdbc.password=lightdb123

数据迁移报错:

lightdb@etl_gbk=# select * from hr.gbk2;
 id | data 
----+------
(0 rows)

lightdb@etl_gbk=# 
 

2023-09-28 15:59:09.234 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.gbk2 ]
2023-09-28 15:59:09.235 [pool-3-thread-1] ERROR com.hundsun.lightdb.core.EtlGlobalCtx - 信息: error data transmission for table hr.case_test 
 堆栈:java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00904: "AAAA": 标识符无效

	at com.hundsun.lightdb.JdbcUtils.doQuery(JdbcUtils.java:33)
	at com.hundsun.lightdb.ImportWorker.run(ImportWorker.java:43)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "AAAA": 标识符无效

	at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
	at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)
	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:229)
	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:41)
	at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:765)
	at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:983)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
	at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1362)
	at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:369)
	at com.hundsun.lightdb.JdbcUtils.doQuery(JdbcUtils.java:30)
	... 6 more
Caused by: Error : 904, Position : 16, Sql = SELECT a,aa,aaa,aaaa from hr.case_test , OriginalSql = SELECT a,aa,aaa,aaaa from hr.case_test , Error Msg = ORA-00904: "AAAA": 标识符无效

	at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513)
	... 19 more

2023-09-28 15:59:09.236 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.sales_orders1 ]
2023-09-28 15:59:09.243 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.sales_orders1 耗时 0 秒]
2023-09-28 15:59:09.243 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.xjh_number10 ]
2023-09-28 15:59:09.254 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.xjh_number10 耗时 0 秒]
2023-09-28 15:59:09.254 [pool-4-thread-1] ERROR com.hundsun.lightdb.core.EtlGlobalCtx - 信息: error data transmission for table gbk2 
 堆栈:java.sql.BatchUpdateException: Batch entry 0 insert into hr.gbk2 (id,data) values ('36'::numeric,'') was aborted: ERROR: character with byte sequence 0xee 0x80 0x80 in encoding "UTF8" has no equivalent in encoding "GBK"  Call getNextException to see other errors in the batch.
	at org.postgresql.jdbc.BatchResultHandler.handleError(zj:182)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:3125)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(le:659)
	at org.postgresql.jdbc.PgStatement.ALLATORIxDEMO(tl:1763)
	at org.postgresql.jdbc.PgStatement.executeBatch(tl:1641)
	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(fj:1540)
	at com.hundsun.lightdb.ImportWorker.lambda$run$0(ImportWorker.java:75)
	at com.hundsun.lightdb.JdbcUtils.doQuery(JdbcUtils.java:31)
	at com.hundsun.lightdb.ImportWorker.run(ImportWorker.java:43)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.postgresql.util.PSQLException: ERROR: character with byte sequence 0xee 0x80 0x80 in encoding "UTF8" has no equivalent in encoding "GBK"
	at org.postgresql.core.v3.QueryExecutorImpl.ALLATORIxDEMO(le:3279)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:1889)
	... 12 more

2023-09-28 15:59:09.254 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.departments ]
2023-09-28 15:59:09.254 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.gbk2 耗时 0 秒]
2023-09-28 15:59:09.262 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.special_orders1 ]
2023-09-28 15:59:09.274 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.special_orders1 耗时 0 秒]
2023-09-28 15:59:09.275 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.medium_orders1 ]
2023-09-28 15:59:09.282 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.medium_orders1 耗时 0 秒]
2023-09-28 15:59:09.282 [pool-3-thread-1] WARN  com.hundsun.lightdb.core.EtlGlobalCtx - 关系已存在 
 堆栈:java.sql.BatchUpdateException: Batch entry 0 insert into hr.departments (department_id,department_name,manager_id,location_id) values ('10'::numeric,'Administration','200'::numeric,'1700'::numeric) was aborted: ERROR: duplicate key value violates unique constraint "dept_id_pk"
  详细:Key (department_id)=(10) already exists.  Call getNextException to see other errors in the batch.
	at org.postgresql.jdbc.BatchResultHandler.handleError(zj:182)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:3125)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(le:659)
	at org.postgresql.jdbc.PgStatement.ALLATORIxDEMO(tl:1763)
	at org.postgresql.jdbc.PgStatement.executeBatch(tl:1641)
	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(fj:1540)
	at com.hundsun.lightdb.ImportWorker.lambda$run$0(ImportWorker.java:75)
	at com.hundsun.lightdb.JdbcUtils.doQuery(JdbcUtils.java:31)
	at com.hundsun.lightdb.ImportWorker.run(ImportWorker.java:43)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "dept_id_pk"
  详细:Key (department_id)=(10) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.ALLATORIxDEMO(le:3279)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:1889)
	... 12 more

2023-09-28 15:59:09.282 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.haha ]
2023-09-28 15:59:09.282 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.departments 耗时 0 秒]
2023-09-28 15:59:09.291 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.haha 耗时 0 秒]
2023-09-28 15:59:09.291 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.a ]
2023-09-28 15:59:09.292 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.job_history ]
2023-09-28 15:59:09.310 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - executed batch hr.a 4
2023-09-28 15:59:09.310 [pool-3-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.a 耗时 0 秒]
2023-09-28 15:59:09.310 [pool-4-thread-1] WARN  com.hundsun.lightdb.core.EtlGlobalCtx - 关系已存在 
 堆栈:java.sql.BatchUpdateException: Batch entry 0 insert into hr.job_history (employee_id,start_date,end_date,job_id,department_id) values ('102'::numeric,'2001-01-13 00:00:00+08','2006-07-24 00:00:00+08','IT_PROG','60'::numeric) was aborted: ERROR: duplicate key value violates unique constraint "jhist_emp_id_st_date_pk"
  详细:Key (employee_id, start_date)=(102, 2001-01-13 00:00:00) already exists.  Call getNextException to see other errors in the batch.
	at org.postgresql.jdbc.BatchResultHandler.handleError(zj:182)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:3125)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(le:659)
	at org.postgresql.jdbc.PgStatement.ALLATORIxDEMO(tl:1763)
	at org.postgresql.jdbc.PgStatement.executeBatch(tl:1641)
	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(fj:1540)
	at com.hundsun.lightdb.ImportWorker.lambda$run$0(ImportWorker.java:75)
	at com.hundsun.lightdb.JdbcUtils.doQuery(JdbcUtils.java:31)
	at com.hundsun.lightdb.ImportWorker.run(ImportWorker.java:43)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "jhist_emp_id_st_date_pk"
  详细:Key (employee_id, start_date)=(102, 2001-01-13 00:00:00) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.ALLATORIxDEMO(le:3279)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:1889)
	... 12 more

2023-09-28 15:59:09.310 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.job_history 耗时 0 秒]
2023-09-28 15:59:09.314 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.test ]

2023-09-28 15:59:08.905 [main] INFO  com.hundsun.lightdb.core.EtlDirector - 表结构对比开始
2023-09-28 15:59:08.909 [main] INFO  com.hundsun.lightdb.core.EtlDirector - hr.gbk2对比一致。

....
2023-09-28 15:59:10.177 [main] INFO  com.hundsun.lightdb.core.EtlDirector - 数据对比开始

gbk2结果不一致 
 	目标:无数据
...

uft8-->gbk:报错

#utf-8
etl.source.jdbc.url=jdbc:oracle:thin:@10.20.30.199:1521/test
etl.source.jdbc.username=hr
etl.source.jdbc.password=hr


# gbk
etl.target.jdbc.url=jdbc:postgresql://10.19.69.252:5444/etl_gbk
etl.target.jdbc.username=lightdb
etl.target.jdbc.password=lightdb123

表结构迁移成功,数据迁移失败。

2023-09-27 18:11:15.664 [pool-7-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.xjh_example_table3 耗时 0 秒]
2023-09-27 18:11:15.664 [pool-4-thread-1] ERROR com.hundsun.lightdb.core.EtlGlobalCtx - 信息: error data transmission for table gbk2 
 堆栈:java.sql.BatchUpdateException: Batch entry 0 insert into hr.gbk2 (id,data) values ('36'::numeric,'') was aborted: ERROR: character with byte sequence 0xee 0x80 0x80 in encoding "UTF8" has no equivalent in encoding "GBK"  Call getNextException to see other errors in the batch.
	at org.postgresql.jdbc.BatchResultHandler.handleError(zj:182)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:3125)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(le:659)
	at org.postgresql.jdbc.PgStatement.ALLATORIxDEMO(tl:1763)
	at org.postgresql.jdbc.PgStatement.executeBatch(tl:1641)
	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(fj:1540)
	at com.hundsun.lightdb.ImportWorker.lambda$run$0(ImportWorker.java:75)
	at com.hundsun.lightdb.JdbcUtils.doQuery(JdbcUtils.java:31)
	at com.hundsun.lightdb.ImportWorker.run(ImportWorker.java:43)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.postgresql.util.PSQLException: ERROR: character with byte sequence 0xee 0x80 0x80 in encoding "UTF8" has no equivalent in encoding "GBK"
	at org.postgresql.core.v3.QueryExecutorImpl.ALLATORIxDEMO(le:3279)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(le:1889)
	... 12 more

2023-09-27 18:11:15.664 [pool-7-thread-1] INFO  com.hundsun.lightdb.ImportWorker - begin data transmission for table [ hr.employee_data ]
2023-09-27 18:11:15.666 [pool-4-thread-1] INFO  com.hundsun.lightdb.ImportWorker - end transfer table [hr.gbk2 耗时 0 秒]

uft8迁移到utf8:

#utf-8
etl.source.jdbc.url=jdbc:oracle:thin:@10.20.30.199:1521/test
etl.source.jdbc.username=hr
etl.source.jdbc.password=hr


# utf8
etl.target.jdbc.url=jdbc:postgresql://10.19.69.252:5432/etlu2
etl.target.jdbc.username=lightdb
etl.target.jdbc.password=lightdb123
[lightdb@lightdb1 lightdb-x-13.8-23.3-14917-el7.x86_64]$ /data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5432
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \c etlu2
You are now connected to database "etlu2" as user "lightdb".
compatible type: oracle
lightdb@etlu2=# show port;
 port 
------
 5432
(1 row)

lightdb@etlu2=# show server_encoding ;
 server_encoding 
-----------------
 UTF8
(1 row)

lightdb@etlu2=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
 36 | 
(15 rows)

lightdb@etlu2=# drop table hr.gbk2;
DROP TABLE
lightdb@etlu2=# 

迁移数据成功:

lightdb@etlu2=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
(15 rows)

lightdb@etlu2=# 

需要通过lt_initdb 指定Gb18030新建一个数据库

# gbk Gb18030  gb18030test
etl.target.jdbc.url=jdbc:postgresql://10.20.30.199:8867/gb18030test
etl.target.jdbc.username=lightdb
etl.target.jdbc.password=lightdb123

lightdb@gb18030test=# SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'gb18030test';
 pg_encoding_to_char 
---------------------
 GB18030
(1 row)

lightdb@gb18030test=# 

lightdb从gb18030->utf8 导入导出测试,数据为空,但行数没少:

lt_dump -Fp -f gb18030test_0928_2.sql  -c -C -E  GB18030 -h 10.20.30.199 -d gb18030test -p 8867

[lightdb@hs-10-20-30-199 xjh]$ lt_dump -Fp -f gb18030test_0928_2.sql  -c -C -E  GB18030 -h 10.20.30.199 -d gb18030test -p 8867
lt_dump: NOTICE:  zhparser add dict : "/home/lightdb/yc/data18030/base/25060/zhprs_dict_gb18030test.txt" failed! if zhparser version is 2.0, then just ignore
[lightdb@hs-10-20-30-199 xjh]$ 
[lightdb@lightdb1 xjh]$ rz

[lightdb@lightdb1 xjh]$ /data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5432 utf_0928<gb18030test_0928_2.sql
SET
SET
SET
SET
SET
 set_config 
------------
 lt_catalog
(1 row)

SET
SET
...
COMMENT
CREATE EXTENSION
COMMENT
CREATE DOMAIN
ALTER DOMAIN
CREATE TYPE
ALTER TYPE
ALTER TYPE

CREATE TYPE
ALTER TYPE
CREATE DOMAIN
ALTER DOMAIN
CREATE TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
SET
SET
CREATE TABLE
ALTER TABLE

CREATE SEQUENCE
ALTER TABLE
CREATE TABLE
ALTER TABLE

CREATE TABLE
ALTER TABLE


CREATE SEQUENCE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE

COPY 0

COPY 27
COPY 4
COPY 3
COPY 12
COPY 4
COPY 107
COPY 15



 setval 
--------
    100
(1 row)


 setval 
--------
    142
(1 row)

 setval 
--------
      4
(1 row)

ALTER TABLE
ALTER TABLE


CREATE INDEX
CREATE INDEX
...

ALTER TABLE
ALTER TABLE
GRANT
[lightdb@lightdb1 xjh]$ ltsql -p 5432
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \c gb18030test
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
lightdb@gb18030test=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
(15 rows)

lightdb@gb18030test=# 

lightdb从gb18030->gbk 导入导出测试,数据为空,但行数没少:

/data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5444 postgres<gb18030test_0928_2.sql

[lightdb@lightdb1 xjh]$ ltsql -p5444
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                              List of databases
   Name    |  Owner  | Encoding |  Collate  |   Ctype   |  Access privileges  
-----------+---------+----------+-----------+-----------+---------------------
 etl       | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =Tc/lightdb        +
           |         |          |           |           | lightdb=CTc/lightdb+
           |         |          |           |           | etl=CTc/lightdb
 etl_gbk   | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =Tc/lightdb        +
           |         |          |           |           | lightdb=CTc/lightdb+
           |         |          |           |           | etl_gbk=CTc/lightdb
 lt_test   | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | 
 postgres  | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | 
 template0 | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =c/lightdb         +
           |         |          |           |           | lightdb=CTc/lightdb
 template1 | lightdb | GBK      | zh_CN.gbk | zh_CN.gbk | =c/lightdb         +
           |         |          |           |           | lightdb=CTc/lightdb
(6 rows)

lightdb@postgres=# \q
[lightdb@lightdb1 xjh]$ ll
total 2007800
drwxrwxr-x 2 lightdb lightdb      4096 Jun 26 17:49 11
drwxrwxr-x 3 lightdb lightdb      4096 Sep 21 16:06 agent
drwxrwxr-x 5 lightdb lightdb      4096 Sep 21 14:14 auto
drwxrwxr-x 5 lightdb lightdb      4096 Sep 20 11:30 etl
-rw-r--r-- 1 lightdb lightdb    502434 Sep 28 17:27 gb18030test_0928_2.sql
-rw-r--r-- 1 lightdb lightdb    527220 Sep 28 17:21 gb18030test_0928.sql
drwxrwxr-x 5 lightdb lightdb      4096 Sep 27 13:26 gbk
-rw-r--r-- 1 lightdb lightdb  69970746 May 23 15:53 lightadb-20230523.tar.gz
-rw-r--r-- 1 lightdb lightdb 448786669 Sep 21 13:34 LightDB1.0-agent-V202303-00-000-el7-x86_64.zip
drwxrwxr-x 7 lightdb lightdb      4096 Sep 20 14:25 LightDB1.0-em-V202303-00-000-el7-x86_64
-rw-r--r-- 1 lightdb lightdb 867927293 Sep 21 13:35 LightDB1.0-em-V202303-00-000-el7-x86_64.zip
-rw-r--r-- 1 lightdb lightdb 668196921 Sep 21 13:33 LightDB1.0-x-V202303-00-000-el7-x86_64.zip
drwxrwxr-x 9 lightdb lightdb      4096 May 16 10:43 lightdb-a-stage
drwxrwxr-x 7 lightdb lightdb      4096 Sep 21 14:13 lightdb-x-13.8-23.3-14917-el7.x86_64
drwxrwxr-x 3 lightdb lightdb      4096 Apr 23 13:19 myfile
drwxr-xr-x 6 root    root         4096 Apr  3 19:02 ora2pg
drwxr-xr-x 3 lightdb lightdb      4096 Apr 23 13:19 sql-convert-runtime
-rw-r--r-- 1 lightdb lightdb       918 May 15 13:22 test_prompt.sql
[lightdb@lightdb1 xjh]$ /data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5444 postgres<gb18030test_0928_2.sql
SET
SET
SET
ERROR:  invalid value for parameter "client_encoding": "GB18030"
DETAIL:  Conversion between GB18030 and GBK is not supported.
SET
 set_config 
------------
 lt_catalog
(1 row)

SET
SET
SET
SET
ERROR:  database "gb18030test" does not exist
CREATE DATABASE
ALTER DATABASE
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
SET
SET
SET
SET
SET
 set_config 
------------
 lt_catalog
(1 row)

SET
SET
SET
SET
CREATE SCHEMA
ALTER SCHEMA
...
CREATE INDEX
CREATE INDEX
ALTER TABLE
ALTER TABLE
GRANT
[lightdb@lightdb1 xjh]$ ltsql -p5444
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                                   List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges  
-------------+---------+----------+---------------+---------------+---------------------
 etl         | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl=CTc/lightdb
 etl_gbk     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl_gbk=CTc/lightdb
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 postgres    | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 template0   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
(7 rows)

lightdb@postgres=# \c gb18030test
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
lightdb@gb18030test=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
(15 rows)

lightdb@gb18030test=# 

用脚本向pg数据库gb18030test插入一个特殊字符:

# 要插入的Unicode字符
unicode_char4 = u'\ue000'

# 执行INSERT语句
cur.execute("INSERT INTO hr.gbk2 (id, data) VALUES (%s, %s)", (38, unicode_char4))
[lightdb@hs-10-20-30-199 xjh]$ ltsql -p8867
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                                   List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges  
-------------+---------+----------+---------------+---------------+---------------------
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 postgres    | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 template0   | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
(5 rows)

lightdb@postgres=# \c gb18030test
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
lightdb@gb18030test=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
 38 | 
(16 rows)

lightdb@gb18030test=# 

lt_dump -Fp -f gb18030test_0928_3.sql  -c -C -E  GB18030 -h 10.20.30.199 -d gb18030test -p 8867

gb18030迁移到GBK:

[lightdb@lightdb1 xjh]$ ltsql -p5444
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                                   List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges  
-------------+---------+----------+---------------+---------------+---------------------
 etl         | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl=CTc/lightdb
 etl_gbk     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl_gbk=CTc/lightdb
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 postgres    | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 template0   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
(7 rows)

lightdb@postgres=# \c gb18030test
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
lightdb@gb18030test=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
(15 rows)

lightdb@gb18030test=# \l
                                   List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges  
-------------+---------+----------+---------------+---------------+---------------------
 etl         | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl=CTc/lightdb
 etl_gbk     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl_gbk=CTc/lightdb
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 postgres    | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 template0   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
(7 rows)

lightdb@gb18030test=# \c etl
You are now connected to database "etl" as user "lightdb".
compatible type: oracle
lightdb@etl=# drop database gb18030test;
DROP DATABASE
lightdb@etl=# \q
[lightdb@lightdb1 xjh]$ rz

[lightdb@lightdb1 xjh]$ 
[lightdb@lightdb1 xjh]$ 
[lightdb@lightdb1 xjh]$ /data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5444 postgres<gb18030test_0928_3.sql
SET
SET
SET
ERROR:  invalid value for parameter "client_encoding": "GB18030"
DETAIL:  Conversion between GB18030 and GBK is not supported.
SET
 set_config 
------------
 lt_catalog
(1 row)

SET
SET
SET
SET
ERROR:  database "gb18030test" does not exist
CREATE DATABASE
ALTER DATABASE
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
SET
SET
SET
SET
SET
 set_config 
------------
 lt_catalog
(1 row)

ALTER TABLE
ALTER TABLE
GRANT
[lightdb@lightdb1 xjh]$ ltsql -p 5444
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                                   List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges  
-------------+---------+----------+---------------+---------------+---------------------
 etl         | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl=CTc/lightdb
 etl_gbk     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =Tc/lightdb        +
             |         |          |               |               | lightdb=CTc/lightdb+
             |         |          |               |               | etl_gbk=CTc/lightdb
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 postgres    | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | 
 template0   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | GBK      | zh_CN.gbk     | zh_CN.gbk     | =c/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb
(7 rows)

lightdb@postgres=# \c gb18030test
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
lightdb@gb18030test=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
 38 | 
(16 rows)

lightdb@gb18030test=# 

gb18030迁移到utf8:

/data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5432 utf_0928<gb18030test_0928_3.sql

[lightdb@lightdb1 xjh]$ ll
total 2008292
drwxrwxr-x 2 lightdb lightdb      4096 Jun 26 17:49 11
drwxrwxr-x 3 lightdb lightdb      4096 Sep 21 16:06 agent
drwxrwxr-x 5 lightdb lightdb      4096 Sep 21 14:14 auto
drwxrwxr-x 5 lightdb lightdb      4096 Sep 20 11:30 etl
-rw-r--r-- 1 lightdb lightdb    502434 Sep 28 17:27 gb18030test_0928_2.sql
-rw-r--r-- 1 lightdb lightdb    502440 Sep 28 17:48 gb18030test_0928_3.sql
-rw-r--r-- 1 lightdb lightdb    527220 Sep 28 17:21 gb18030test_0928.sql
drwxrwxr-x 5 lightdb lightdb      4096 Sep 27 13:26 gbk
-rw-r--r-- 1 lightdb lightdb  69970746 May 23 15:53 lightadb-20230523.tar.gz
-rw-r--r-- 1 lightdb lightdb 448786669 Sep 21 13:34 LightDB1.0-agent-V202303-00-000-el7-x86_64.zip
drwxrwxr-x 7 lightdb lightdb      4096 Sep 20 14:25 LightDB1.0-em-V202303-00-000-el7-x86_64
-rw-r--r-- 1 lightdb lightdb 867927293 Sep 21 13:35 LightDB1.0-em-V202303-00-000-el7-x86_64.zip
-rw-r--r-- 1 lightdb lightdb 668196921 Sep 21 13:33 LightDB1.0-x-V202303-00-000-el7-x86_64.zip
drwxrwxr-x 9 lightdb lightdb      4096 May 16 10:43 lightdb-a-stage
drwxrwxr-x 7 lightdb lightdb      4096 Sep 21 14:13 lightdb-x-13.8-23.3-14917-el7.x86_64
drwxrwxr-x 3 lightdb lightdb      4096 Apr 23 13:19 myfile
drwxr-xr-x 6 root    root         4096 Apr  3 19:02 ora2pg
drwxr-xr-x 3 lightdb lightdb      4096 Apr 23 13:19 sql-convert-runtime
-rw-r--r-- 1 lightdb lightdb       918 May 15 13:22 test_prompt.sql
[lightdb@lightdb1 xjh]$ ltsql -p 5432
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                                    List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges   
-------------+---------+----------+---------------+---------------+----------------------
 etl         | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | etl=CTc/lightdb
 etlu2       | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | etlu2=CTc/lightdb
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | 
 postgres    | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | 
 template0   | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =c/lightdb          +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =c/lightdb          +
             |         |          |               |               | lightdb=CTc/lightdb
 utf_0928    | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | utf_0928=CTc/lightdb
 utf_etl     | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | 
 xjh         | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | xjh=CTc/lightdb
(10 rows)

lightdb@postgres=# drop database gb18030test;
DROP DATABASE
lightdb@postgres=# \q
[lightdb@lightdb1 xjh]$ /data2/xjh/auto/lightdb-x/13.8-23.3/bin/ltsql -p 5432 utf_0928<gb18030test_0928_3.sql
SET
SET
SET
SET
SET
 set_config 
------------
 lt_catalog
(1 row)

SET
SET
SET
SET
ERROR:  database "gb18030test" does not exist
CREATE DATABASE
ALTER DATABASE
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
SET
SET
SET
SET
SET
 set_config 
------------
 lt_catalog
(1 row)


ALTER TABLE
ALTER TABLE
GRANT
[lightdb@lightdb1 xjh]$ ltsql -p5432
ltsql (13.8-23.3)
compatible type: postgresql
Type "help" for help.

lightdb@postgres=# \l
                                    List of databases
    Name     |  Owner  | Encoding |    Collate    |     Ctype     |  Access privileges   
-------------+---------+----------+---------------+---------------+----------------------
 etl         | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | etl=CTc/lightdb
 etlu2       | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | etlu2=CTc/lightdb
 gb18030test | lightdb | GB18030  | zh_CN.gb18030 | zh_CN.gb18030 | 
 lt_test     | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | 
 postgres    | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | 
 template0   | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =c/lightdb          +
             |         |          |               |               | lightdb=CTc/lightdb
 template1   | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =c/lightdb          +
             |         |          |               |               | lightdb=CTc/lightdb
 utf_0928    | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | utf_0928=CTc/lightdb
 utf_etl     | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | 
 xjh         | lightdb | UTF8     | en_US.utf8    | en_US.utf8    | =Tc/lightdb         +
             |         |          |               |               | lightdb=CTc/lightdb +
             |         |          |               |               | xjh=CTc/lightdb
(10 rows)

lightdb@postgres=# \c gb18030test
You are now connected to database "gb18030test" as user "lightdb".
compatible type: postgresql
lightdb@gb18030test=# select * from hr.gbk2;
 id |               data                
----+-----------------------------------
 36 | 
 37 | 
  1 | fhsjdhfjs看到回國的飛機共和黨國會
  2 | 付款的官方的理工科              
  3 | 看來是價格                      
  4 | 快攻打法瞭解更多                
  5 | 84375jkdgkfckvkb堅不可摧v       
  6 | ;報價參考報價下                
  7 | 老闆超級不開心                  
  8 | 了從包括v菠蘿快車v了            
  9 | 从离开滨江屡见不鲜              
 10 | 查看背景下来不及  差旅不可撤销吧
 11 | clvjbxj   
 12 | 了出现崩溃
 13 | 查看下礼拜
 38 | 
(16 rows)

lightdb@gb18030test=# 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1055330.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Python操作自动化

迷途小书童 读完需要 3分钟 速读仅需 1 分钟 当我们需要自动化进行一些重复性的任务时&#xff0c;Python 中的 pyautogui 库就可以派上用场了&#xff0c;这个库可以模拟鼠标和键盘的操作&#xff0c;让我们的程序可以像人一样与计算机进行交互。 首先&#xff0c;我们需要安装…

Beats Studio Buds 连接 Windows 11 声音输出不显示设备

Beats Studio Buds 连接 Windows 11 声音输出不显示设备 Beats Studio Buds 蓝牙耳机连接Windows 11电脑后&#xff0c;无法通过耳机播放声音&#xff0c;在声音输出选项中也没有耳机选项。 问题 蓝牙耳机连接电脑。 在声音输出中查看输出设备选项。 解决方法 以管理员身…

LeetCode每日一题 | 309.买卖股票的最佳时机含冷冻期

题目链接&#xff1a; 309. 买卖股票的最佳时机含冷冻期 - 力扣&#xff08;LeetCode&#xff09; 题目描述&#xff1a; 算法图解&#xff1a; 解题代码&#xff1a; class Solution { public:int maxProfit(vector<int>& prices) {int n prices.size();vector&…

求∑(1,n)⌊k/i⌋∗i

对于[k/i]*i,我们可以分两端&#xff0c;前,最多有段&#xff0c;后边从到n&#xff0c;取值范围为1-&#xff0c;所以最多有段&#xff0c;共2*段。对于每段从i开始&#xff0c;其上界jk/(k/i)&#xff08;维持k/i不变最大范围i-j&#xff09;。 计算[k/i]*i时间复杂度降到级…

Android 命令行工具简介

关于作者&#xff1a;CSDN内容合伙人、技术专家&#xff0c; 从零开始做日活千万级APP。 专注于分享各领域原创系列文章 &#xff0c;擅长java后端、移动开发、商业变现、人工智能等&#xff0c;希望大家多多支持。 目录 一、导读二、概览三、相关工具3.1 Android SDK 命令行工…

TempleteMethod

TempleteMethod 动机 在软件构建过程中&#xff0c;对于某一项任务&#xff0c;它常常有稳定的整体操作结构&#xff0c;但各个子步骤却有很多改变的需求&#xff0c;或者由于固有的原因 &#xff08;比如框架与应用之间的关系&#xff09;而无法和任务的整体结构同时实现。如…

数据结构学习笔记(基础)

绪论 数据结构三要素&#xff08;数据的基本单位是数据元素&#xff0c;数据元素可由若干个数据项组成&#xff0c;一个数据项是构成数据元素的不可分割的最小单位&#xff09; 数据&#xff1a;指的是能被计算机识别、存储和加工处理的信息载体&#xff08;如 Word 文档&#…

【设计模式_实验①_第六题】设计模式——接口的实验模拟应用实验作业一

【实验要求】 货车要装载一批货物&#xff0c;货物由三种商品组成&#xff1a;电视、计算机和洗衣机。卡车需要计算出整批货物的重量。 【实验步骤】UML 过程 在这里插入代码片 public interface ComputerWeight {public abstract double computerWeight(); }public class T…

GD32 看门狗

1. 看门狗的概念 2. 独立看门狗 独立看门狗的原理&#xff1a;设定一个重载值。赋值计数器。每来一个脉冲计数值减减。如果计数值减到0。还没有去喂狗就会产生复位。所以在计数值在0~重载值范围必须要喂一次狗。 在键值寄存器(IWDG_KR)中写入0xCCCC&#xff0c;开始启用独立看…

嵌入式Linux应用开发-基础知识-第十八章系统对中断的处理③

嵌入式Linux应用开发-基础知识-第十八章系统对中断的处理③ 第十八章 Linux系统对中断的处理 ③18.5 编写使用中断的按键驱动程序 ③18.5.1 编程思路18.5.1.1 设备树相关18.5.1.2 驱动代码相关 18.5.2 先编写驱动程序18.5.2.1 从设备树获得 GPIO18.5.2.2 从 GPIO获得中断号18.5…

嵌入式Linux应用开发-基础知识-第十九章驱动程序基石①

嵌入式Linux应用开发-基础知识-第十九章驱动程序基石① 第十九章 驱动程序基石①19.1 休眠与唤醒19.1.1 适用场景19.1.2 内核函数19.1.2.1 休眠函数19.1.2.2 唤醒函数 19.1.3 驱动框架19.1.4 编程19.1.4.1 驱动程序关键代码19.1.4.2 应用程序 19.1.5 上机实验19.1.6 使用环形缓…

Android自动化测试之MonkeyRunner--从环境构建、参数讲解、脚本制作到实战技巧

monkeyrunner 概述、环境搭建 monkeyrunner环境搭建 (1) JDK的安装不配置 http://www.oracle.com/technetwork/java/javase/downloads/index.html (2) 安装Python编译器 https://www.python.org/download/ (3) 设置环境变量(配置Monkeyrunner工具至path目彔下也可丌配置) (4) …

【C语言经典100例题-66】(用指针解决)输入3个数a,b,c,按大小顺序输出。

代码&#xff1a; #include<stdio.h> #define _CRT_SECURE_NO_WARNINGS 1//VS编译器使用scanf函数时会报错&#xff0c;所以添加宏定义 swap(p1, p2) int* p1, * p2; {int p;p *p1;*p1 *p2;*p2 p; } int main() {int n1, n2, n3;int* pointer1, * pointer2, * point…

【人工智能导论】线性回归模型

一、线性回归模型概述 线性回归是利用函数对一个或多个自变量和因变量之间关系进行建模的一种回归分析。简单来说&#xff0c;就是试图找到自变量与因变量之间的关系。 二、线性回归案例&#xff1a;房价预测 1、案例分析 问题&#xff1a;现在要预测140平方的房屋的价格&…

【单片机】14-I2C通信之EEPROM

1.EEPROM概念 1.EEPROM 1.1 一些概念 &#xff08;1&#xff09;一些概念&#xff1a;ROM【只读存储器---硬盘】&#xff0c;RAM【随机访问存储器--内存】&#xff0c;PROM【可编程的ROM】&#xff0c;EPROM【可擦除ROM】&#xff0c;EEPROM【电可擦除ROM】 1.2 为什么需要EE…

Ps:移动工具

移动工具 Move Tool是 Ps 最常用的工具之一。使用移动工具&#xff0c;不仅可以移动、复制对象&#xff0c;还可以对多个图层进行对齐、分布等操作。 快捷键&#xff1a;V 使用快捷键改变图层不透明度或者选择图层混合模式时&#xff0c;也建议先切换到移动工具状态。 ◆ ◆ …

CS SD NAND在STM32精英V2开发板的测试-是时候将TF卡换为SD NAND了

前言 嵌入式项目中,比较常见的存储扩展方案是使用TF/SD卡或者EMMC或者RAW NAND,各种方案都有其优缺点,而SD NAND相对于上述方案具备很多优势,是目前嵌入式项目中存储扩展方案的一个非常不错的选择,正好一个项目在选择NAND存储方案, 恰巧论坛中联系到雷龙公司申请到了两片SD NAN…

LCD 的RGB接口(SYNC Mode/ SYNC-DE Mode/ DE Mode)

1、 SYNC Mode Timing Diagram 2、 SYNC-DE Mode Timing Diagram 3、 DE Mode Timing Diagram RGB接口&#xff08;SYNC Mode/ SYNC-DE Mode/ DE Mode&#xff09;-CSDN博客

【复盘】记录一次锁库的生产故障

java.sql.SQLException: The MySQL server is running with the LOCK_WRITE_GROWTH option so it cannot execute this statement在国庆期间晚上突然收到系统报警&#xff0c;然后查看日志发现是数据库磁盘满了之后触发了&#xff0c;禁止写操作&#xff0c;删除数据都不可以。…

Node18.x基础使用总结(二)

Node18.x基础使用总结 1、Node.js模块化1.1、模块暴露数据1.2、引入模块 2、包管理工具2.1、npm2.2、npm的安装2.3、npm基本使用2.4、搜索包2.5、下载安装包2.6、生产环境与开发环境2.7、生产依赖与开发依赖2.8、全局安装2.9、修改windows执行策略2.10、安装包依赖2.11、安装指…