记录一下信创改造遇到的问题

本文介绍了将Oracle数据库迁移到华为GaussDB时的关键步骤,包括主键要求、视图与函数处理、Java问题(如DNS解析和字体库)、SQL适配(如rownum和rowid)、以及字符串和日期函数的转换。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Oracle迁移gaussdb

迁移gaussdb使用的是华为官方提供的华为UGO+DRS工具实现,还是比较简单方便的 迁移过程中 需要注意所有表需要有主键,而所用视图、函数、触发器、存储过程必须是有效状态,才能迁移成功。人工干预的比较少,相对稳定 效果还是不错的。

信创服务器 银河麒麟+arm架构

1.会存在dns解析问题 导致Java应用启动慢反应慢。
2.会存在字体库问题 导致Java 操作excel pdf出现乱码 抛异常等 例如:Aspose.cell Excel转Pdf抛出CellsException
3.中间件采用的 tongweb,tongweb需要有授权文件license.bat 才能启动运行

Java程序sql的适配问题

虚拟表dual
Oracle获取一个常量需要通过一个dual,guassdb/Opengauss不需
虚拟列rownum
对于查询返回的每行数据,rownum虚拟列会返回一个数字,第一行的ROWNUM为1,第二行为2,以此类推。
rownum在select列表中时重写为row_number() over ()
rownum在where子句中时重写为limit… offset…
虚拟列rowid
Oracle中的rowid虚拟列返回特定行的具体地址,在gauss中重写为tableoid || ‘#’ || ctid

字符串函数
nvl(col, value)
Oracle中的nvl(col, value)用来设置默认值,col为空就设置为value;
在gauss中重写为coalesce
Oracle中的decode(arg1, arg2, arg3, arg4)函数, 表示当 arg1 等于 arg2 时,取 arg3,否则取 arg4。
postgre中没有类似的函数,可以重写为case… when…
但是guassdb 已经兼容decode 函数了
Oracle中的add_months 函数主要是对日期函数进行操作,对日期按月增加。在Opengauss没有对应的函数,需将其转化为基于日期和interval的运算。或者自己写一个add_months 函数代替,
guassdb数据库中 string_agg()函数 可以实现列转行,将某个字段值连接成一个字符串,并用逗号和空格(, )作为分隔符。

string_agg(column_name, separator)  

日期操作函数

select sysdate; --Timestamp
select now(); --Timestampz
/**
YYYY 表示4位年份
MM 表示2位月份
DD 表示2位天数
HH24 表示24小时制的小时数
MI 表示分钟数
SS 表示秒数
*/
-- 时间戳转字符串
SELECT to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') AS formatted_date;
-- 字符串转日期
SELECT to_date('2025-01-01', 'YYYY-MM-DD');
SELECT CAST('2025-01-01' AS DATE);
-- 日期截取
/**'microseconds'(微秒)
'milliseconds'(毫秒)
'second' 或 'seconds'(秒)
'minute' 或 'minutes'(分钟)
'hour' 或 'hours'(小时)
'day' 或 'days'(天)
'week' 或 'weeks'(周)
'month' 或 'months'(月)
'quarter' 或 'quarters'(季度)
'year' 或 'years'(年)‌*/
SELECT date_trunc('day', current_timestamp); --2025-01-20 00:00:00.000 +0800
SELECT date_trunc('hour', current_timestamp);--2025-01-20 17:00:00.000 +0800
Oraclegaussdb/openguass
select 2 from dualselect 2
select rownum from customer;select row_number() over () as rownum from customer
select tableoid from customer where rownum < 10 and rownum >= 2;select tableoid from customer limit 9 OFFSET 2
select rowid, c.* from customer c;select tableoid || ‘#’ || ctid, c.* from customer as c
select nvl(c_phone, 1) from customer;select coalesce(customer.c_phone, ‘1’) from customer
select nvl2(c_phone, 1, 2) from customer;select case when c_phone is null then 1 else 2 end from customer
select decode(c_phone,‘110’, 1 , 2) from customer;select case when c_phone = ‘110’ then 1 else 2 end from customer
select substr(c_phone, 1 , -2 ) from customer;select substr(c_phone, 1, length(c_phone) - 2) from customer
select instr(‘123’, ‘23’)select strpos(‘123’, ‘23’)
select replace(‘123’,‘1’);select replace(‘123’,‘1’,‘’);
select listagg(c_name,‘,’) as name from customer group by c_phoneselect string_agg(c_name,‘,’) as name from customer group by c_phone
select listagg(c_name,‘,’) within group(order by c_name) over (partition by c_phone) as name from customer;sselect string_agg(customer.c_name, ‘,’) over (partition by customer.c_phone order by c_custkey) as name from customer
select listagg(c_name,‘,’) within group(order by c_name) as name from customer group by c_phone;select max(paw_dt.name) as name from (select string_agg(customer.c_name, ‘,’) over (partition by customer.c_phone order by c_name) as name, customer.c_phone from customer) as paw_dt group by c_phone
select listagg(c_name,‘,’) within group(order by c_name) as name from customer group by c_phoneselect string_agg(c_name,‘,’) as name from customer group by c_phone
select sysdateselect sysdate/select current_timestamp
select sysdate()select sysdate/select now()
select systimestampselect current_timestamp
select trunc( 111.23,2)select trunc( 111.23,2)
select trunc(sysdate,‘year’)select date_trunc(‘year’, current_timestamp)
select trunc(sysdate)select date_trunc(‘dd’, current_timestamp)
select add_months(sysdate, 2)select current_timestamp + 2 * interval ‘1 month’
select add_months(sysdate, 2)select cast(date_trunc(‘MONTH’, current_timestamp) + interval ‘1 MONTH - 1 DAY’ as date)
select c_name from customer having count(*) > 2 group by c_nameselect c_name from customer group by c_name having count(*) > 2
select unique c_phone from customerselect distinct customer.c_phone from customer
select c_custkey from customer minus select o_custkey from ordersselect c_custkey from customer except select o_custkey from orders
delete customer where 1=0;delete from customer where 1 = 0;
insert into customer nologging select * from customer_bk;insert into customer select * from customer_bk;
insert into t as select c1 from t1insert into t select c1 from t1
select * from (select * from CUSTOMER)select * from (select * from CUSTOMER) as foo
update customer c set c.c_name = ‘xxx’ where c_custkey = 1;update customer set c_name = ‘xxx’ where c_custkey = 1
select substr(1234.1, 0, 4)select substr(‘1234.1’, 1, 4+1)
select substr(‘1234.1’, 0, ‘2’)select substr(‘1234.1’, 0, 2)
select sum(‘2’)select sum(2)
select round(‘2’)select round(2)
select to_number(c_phone) from customer;select cast(c_phone as numeric) from customer
select to_char(12345) as string_value from dual;
select to_char(123.45, ‘fm99999d99’) as formatted_string from dual;select your_numeric_column::varchar from your_table;
### Java项目改造成本估算 #### 1. 费用构成因素分析 对于Java项目的改造,费用的构成主要包括以下几个方面: - **人力成本**:这是最主要的成本之一。根据项目规模的不同,可能涉及不同层次和技术专长的人力资源投入。考虑到地区差异以及具体需求复杂度的影响,建议参照项目所在地的息技术服务费用来评估这部分支出更为合理[^1]。 - **工具链迁移开销**:如果原有环境依赖某些特定于国外生态系统的构建、测试或部署工具,则需考虑替换为兼容国内自主可控平台版本所带来的额外工作量及时效损失补偿。 - **软硬件适配调试代价**:针对新环境下可能出现的功能不匹配问题进行针对性调整优化直至满足预期性能指标为止的过程会产生相应的时间周期延长风险溢价。 - **培训教育投资**:为了使团队成员能够快速掌握新的技术和框架特性,往往还需要安排专门的学习课程或者邀请外部专家指导讲座等形式来加速知识传递效率并降低试错成本。 #### 2. 成本估算方法论 基于上述各项要素综合考量后得出总体预算范围的方法可以概括如下几点: - 对照同行业类似案例的历史记录作为参考依据; - 结合当前市场价格水平动态调整权重参数取值区间; - 预留一定比例的风险准备金用于应对不可预见事件的发生概率及其潜在影响程度预估。 值得注意的是,由于各家公司具体情况存在较大区别,因此最终报价应当由专业的咨询顾问深入调研后再做定夺。 ```java // 示例代码片段展示了一个简单的成本计算模型实现方式 public class CostEstimation { private double manpowerCost; private double toolMigrationExpense; private double hardwareCompatibilityAdjustment; public void setManpowerCost(double value){ this.manpowerCost = value; } public void setToolMigrationExpense(double value){ this.toolMigrationExpense = value; } public void setHardwareCompatibilityAdjustment(double value){ this.hardwareCompatibilityAdjustment = value; } public double getTotalEstimatedCost(){ return (manpowerCost + toolMigrationExpense + hardwareCompatibilityAdjustment)*1.1; // 加入10%风险管理储备 } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大卫空中擦了屁飘一声思密达

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值