1、背景
insert into cm.f_l_c_eutrancelltdd_history select * from cm.f_l_c_eutrancelltdd_history@gsyd where start_time>=trunc(sysdate);
同步数据时报错表被锁
2、核查过程
2.1 首先查询表是否被锁:
-- 查看所有被锁的表
select b.owner TABLEOWNER, b.object_name TABLENAME, c.OSUSER LOCKBY,
c.USERNAME LOGINID, c.sid SID, c.SERIAL
from v$locked_object a,dba_objects b, v$session c
where b.object_id = a.object_id AND a.SESSION_ID =c.sid;
发现要同步的表并没有被锁 如果表被锁,请解锁
--通过SID, SERIAL解锁
--alter system kill session 'SID, SERIAL';
2.2 查询远程表 只查询远程表select * from cm.f_l_c_eutrancelltdd_history@gsyd where start_time>=trunc(sysdate); 居然报错了,报错信息:
ORA-22992: 无法使用从远程表选择的 LOB 定位符
22992. 00000 - "cannot use LOB locators selected from remote tables"
*Cause: A remote LOB column cannot be referenced.
*Action: Remove references to LOBs in remote tables.
查看远程表结构,发现确实存在大数据字段
3、解决办法
3.1 将CLOB大数据字段剔除,同步其他字段
insert into cm.f_l_c_eutrancelltdd_history
(MANAGEDELEMENT_UK,MANAGEDELEMENT_NAME,ENBFUNCTION_UK,ENBFUNCTION_NAME,DN,UNIQUE_KEY,ID,USER_LABEL,ADMINISTRATIVE_STATE,OPERATIONAL_STATE,CELL_LOCAL_ID,CELL_SIZE,PLMN_IDLIST,TAC,PCI,PCI_LIST,MAX_TRANSMISSION_POWER,REFERENCE_SIGNAL_POWER,PB,CELL_RESV_INFO,BAND_INDICATOR,EARFCN,BAND_WIDTH,SF_ASSIGNMENT,SPECIAL_SF_PATTERNS,CGI,ECARRIER_NUM,COVER_TYPE,SCENE_NAME,DISTRICT_NAME,SOFTWARE_VERSION,LATITUDE,LONGITUDE,BOUNDARY_TYPE,IS_REMOTE,WORK_FRQBAND,ADJ_LTE_NUM,ADJ_TD_NUM,ADJ_GSM_NUM,OMC_UK,OMC_NAME,VENDOR_UK,VENDOR_NAME,COUNTRY_UK,COUNTRY_NAME,CITY_ID,CITY_NAME,PROVINCE_UK,PROVINCE_NAME,STATE,START_TIME,TIME_STAMP,ENB_VIRTUALGROUP_ID,ENB_VIRTUALGROUP_NAME,TIMESTAMP,ELE_ANGEL,ANT_ANGEL,ALL_ANGEL,AZIMUTH,ANT_HEIGHT,ENB_ID,QICI,TOTAL_ANGLE,ANTENNA_HEIGHT,BEARING,IS_COUNTRY,IS_FDD_TDD,MAINTENANCE,DOWNTILT_MACH,TOTAL_DOWNTILT,RET_TILT_VALUE,VERSION,PATCHINFO,SUPPORTRRCNUMBERS,SUPPORTACTIVERRCNUMBERS,ULCOMPSWITCH,DLCOMPSWITCH,ULMUMIMOSWITCH,DLMUMIMOSWITCH,ULICICSWITCH,DLICICSWITCH,ULFSSSWITCH,DLFSSSWITCH,MULTIBANDINFOLISTSIB1,MULTIBANDINFOLISTSIB5,HEADERCOMPRESSIONSWITCH,SPSSWITCHQCI1UL,CASWITCHUL,CASWITCHDL,COVER_AREA,DEVICE_MODEL,DEVICE_TYPE_ROUGH,DISTRIBUTED_INTEGRATION,CELL_LOCATION,NODEB_LOCATION,NE_MODE,BANDWIDTHUL,BANDWIDTHDL,ANROPTCONTROLTIMEOUT,RMUID,EARFCNDL,EARFCNUL,ECGI,EMTCCELEVELS,EMTCIDLEEDRXALLOWEDSWITCH,EMTCCONNECTEDRXSWITCH,QRXLEVMINCE,PCIOPTRPTSWITCH,ANROPTRPTSWITCH,MROOPTREPSWITCH,SHREPSWITCH,ROOTSEQUENCEINDEX)
select
MANAGEDELEMENT_UK,MANAGEDELEMENT_NAME,ENBFUNCTION_UK,ENBFUNCTION_NAME,DN,UNIQUE_KEY,ID,USER_LABEL,ADMINISTRATIVE_STATE,OPERATIONAL_STATE,CELL_LOCAL_ID,CELL_SIZE,PLMN_IDLIST,TAC,PCI,PCI_LIST,MAX_TRANSMISSION_POWER,REFERENCE_SIGNAL_POWER,PB,CELL_RESV_INFO,BAND_INDICATOR,EARFCN,BAND_WIDTH,SF_ASSIGNMENT,SPECIAL_SF_PATTERNS,CGI,ECARRIER_NUM,COVER_TYPE,SCENE_NAME,DISTRICT_NAME,SOFTWARE_VERSION,LATITUDE,LONGITUDE,BOUNDARY_TYPE,IS_REMOTE,WORK_FRQBAND,ADJ_LTE_NUM,ADJ_TD_NUM,ADJ_GSM_NUM,OMC_UK,OMC_NAME,VENDOR_UK,VENDOR_NAME,COUNTRY_UK,COUNTRY_NAME,CITY_ID,CITY_NAME,PROVINCE_UK,PROVINCE_NAME,STATE,START_TIME,TIME_STAMP,ENB_VIRTUALGROUP_ID,ENB_VIRTUALGROUP_NAME,TIMESTAMP,ELE_ANGEL,ANT_ANGEL,ALL_ANGEL,AZIMUTH,ANT_HEIGHT,ENB_ID,QICI,TOTAL_ANGLE,ANTENNA_HEIGHT,BEARING,IS_COUNTRY,IS_FDD_TDD,MAINTENANCE,DOWNTILT_MACH,TOTAL_DOWNTILT,RET_TILT_VALUE,VERSION,PATCHINFO,SUPPORTRRCNUMBERS,SUPPORTACTIVERRCNUMBERS,ULCOMPSWITCH,DLCOMPSWITCH,ULMUMIMOSWITCH,DLMUMIMOSWITCH,ULICICSWITCH,DLICICSWITCH,ULFSSSWITCH,DLFSSSWITCH,MULTIBANDINFOLISTSIB1,MULTIBANDINFOLISTSIB5,HEADERCOMPRESSIONSWITCH,SPSSWITCHQCI1UL,CASWITCHUL,CASWITCHDL,COVER_AREA,DEVICE_MODEL,DEVICE_TYPE_ROUGH,DISTRIBUTED_INTEGRATION,CELL_LOCATION,NODEB_LOCATION,NE_MODE,BANDWIDTHUL,BANDWIDTHDL,ANROPTCONTROLTIMEOUT,RMUID,EARFCNDL,EARFCNUL,ECGI,EMTCCELEVELS,EMTCIDLEEDRXALLOWEDSWITCH,EMTCCONNECTEDRXSWITCH,QRXLEVMINCE,PCIOPTRPTSWITCH,ANROPTRPTSWITCH,MROOPTREPSWITCH,SHREPSWITCH,ROOTSEQUENCEINDEX
from cm.f_l_c_eutrancelltdd_history@wxwy where start_time>=trunc(sysdate);
剔除掉大数据字段后还是无法同步,重启数据库
3.2 重启数据库或服务 上一步无法解决文件,说明还是表有问题。无法通过sid解锁,只能重启数据库或服务了。
root 用户 shutdown -Fr now 重启服务 重启服务时刚输入shutdown -Fr now命令时,还可以输入其他命令,最好不要输入其他命令。等待一会儿就显示断开连接,此时你连接不上服务器。用其他服务器ping该地址,等可以Ping通了,说明内核已启。再等待一会,服务器才可以登录。 重启之后测试数据库是否自动启动
sqlplus '/as sysdba'
select 1 from dual;
都正常时再登录一下数据库客户端,能够连接说明一切OK。
oracle 用户 重启数据库
sqlplus '/as sysdba'
shutdown immediate;
startup;
select 1 from dual;
|