ORA-01732: 此视图的数据操纵操作非法
来源:互联网 发布:做软件的工具 编辑:程序博客网 时间:2024/06/05 22:48
问题描述
oracle数据库有创建materialized views,备份成功,恢复时出现警告:
..正在导入表 “TESTMAVIEW”IMP-00058: 遇到 ORACLE 错误 1732ORA-01732: 此视图的数据操纵操作非法
备注:
执行恢复前未删除materialized views,数据库恢复失败;
删除materialized views,数据库恢复成功。
原因
物化视图可像表一样存储数据,通过pl/sql查看对象列表时发现创建的物化视图在tables对象列中,而通过drop语句直接删除物化视图对象报错:
ORA-12003:必须用DROP MATERIALIZED VIEW 来删除物化视图。
ps:因为是通过程序进行数据库备份,所以会先删除数据库中存在的表及其他对象,然后调用imp命令进行数据库导入。
解决方法
先通过调用DROP MATERIALIZED VIEW mv_name 删除所有的物化视图,再删除其他表对象。
代码
protected ConnectionConfBuilder connectionConfBuilder;protected Connection connection;/** * @Title: romveObject * @Description: 删除数据库对象 * @param dbType * @throws EbeimException * @author zxk * @version 1.0 */public void romveObject(String dbType) throws EbeimException { // 创建连接解析器 this.connectionConfBuilder = IOCUtils.getBean(ConnectionConfBuilderUtils.getConnectionConfBuilderName(dbType)); this.connectionConfBuilder.initialize(super.dbConfig); // 删除MATERIALIZED VIEW this.dropMaterializedView(2, "MATERIALIZED VIEW");}/** * @Title: dropMaterializedView * @Description: 删除dropMaterialized View * @param count * @throws EbeimException * @author zxk * @version 1.0 */ private void dropMaterializedView(int count, String objectType) throws EbeimException { ResultSet rs = null; PreparedStatement pStatement = null; PreparedStatement dropStatement = null; try { this.getConnection(count); pStatement = this.connection .prepareStatement("select OBJECT_NAME from user_objects where object_type='" + objectType + "'"); rs = pStatement.executeQuery(); while (rs.next()) { String tt = rs.getString("OBJECT_NAME"); // 获取对象名 try { String dropsql = "DROP MATERIALIZED VIEW " + tt; dropStatement = this.connection.prepareStatement(dropsql); dropStatement.executeUpdate(); } catch (SQLException e1) { LOG.error("删除[{}]失败", tt, e1); if (dropStatement != null) { dropStatement.close(); } } dropStatement.close(); } } catch (Exception e) { throw new EbeimException("删除" + objectType + "失败" + "-->" + e.getMessage(), e); } finally { try { if (rs != null) { rs.close(); } if (pStatement != null) { pStatement.close(); } } catch (Exception e) { LOG.error("关闭数据库连接失败"); } }}/** * @Title: getConnection * @Description:获取连接 * @param count * @throws EbeimException * @version 1.0 */ private void getConnection(int count) throws EbeimException { try { Driver driver = this.connectionConfBuilder.getDriver(); String url = this.connectionConfBuilder.getUrl().replaceAll("%", "%25"); Properties info = new Properties(); info.setProperty("user", connectionConfBuilder.getUserName()); info.setProperty("password", connectionConfBuilder.getPassword()); this.connection = driver.connect(url, info); } catch (Exception e) { count = count - 1; if (count <= 0) { throw new EbeimException("获取数据库连接失败" + e.getMessage(), e); } // 休眠 try { // 休眠5秒钟后重新获取 Thread.sleep(5000); } catch (InterruptedException ex) { } getConnection(count); } }
1 0
- ORA-01732: 此视图的数据操纵操作非法
- ORA-01732: 此视图的数据操纵操作非法 解决方案 oracle10g
- my ecliipse 操纵视图的操作
- (五):数据操纵语言中数据的操作
- ora-02069 此操作的Global_names必须设置为True
- ORA-01036:非法的变量名/编号
- ORA-01036: 非法的变量名/编号
- ORA-01036: 非法的变量名/编号
- ORA-01036: 非法的变量名/编号
- ORA-01036: 非法的变量名/编号
- ora-01036: 非法的变量名/编号
- Update 视图“ORA-01733: 此处不允许虚拟列” 分享
- 视图+视图DML操作+获取用户的所有表名或视图名+视图插入数据
- ORA-02069: 此操作的global_names参数必须设置为TRUE
- Oracle ORA-02069 此操作的 global_names 参数必须设置为 TRUE
- powerbuilder操纵数据窗口的数据
- 数据操纵
- 操纵数据
- strstr函数的一个小应用
- listview多条目加载
- 找出字符串至少两个顺序字段的所有组合
- I(1894): Moogle
- Java中,&&与&,||与|的区别
- ORA-01732: 此视图的数据操纵操作非法
- 大型网站技术架构-第4篇 架构师
- GDOI 2017 结束了。
- 读书笔记《Effective C++》条款04:确定对象被使用前已先被初始化
- tar命令的使用
- BZOJ4568 [线性基][树链剖分][线段树]
- InitializingBean的使用
- 表示数值的字符串。。。直接,暴力
- 项目管理过程组·五