oracle 日常运维

1.查询表或存储过程、函数异常

  select *  from user_errors where name ='TEST_TABLE'

2.查询表是否存在

  select * from user_tables where table_name='TEST_TABLE'

3.查询表结构

  select  table_name,column_name,data_type,nullable  from user_tab_cols where table_name ='TEST_TABLE'
  --表名注意大写       

4.查询指定时间的数据

  select * from test_table as of timestamp to_timestamp('2019-12-07 14:30:00','yyyy-MM-dd hh24:mi:ss')
  --仅可查询未修改过表结构且短时间内的历史数据
  --truncate删除的数据不能被查询到
  --适用于delete操作误删除的数据,可以查询并恢复

5.新增表结构

  alter table test_table add url varchar2(200) null

6.修改表结构

  alter table test_table modify url varchar2(100)

7.&拼接字符串转义

  --错误写法
  update test_table set url='http://www.public-key.top?id=001&name=zjc' where t1='t001'
  --正确写法
  update test_table set url='http://www.public-key.top?id=001'||chr(38)||'name=zjc' where t1='t001'

 更多日常运维指南,持续更新。。。。。。。。。

                 

猜你喜欢

转载自www.cnblogs.com/zjc2018/p/12001601.html