城市獵人

          在一網情深的日子里,誰能說得清是苦是甜,只知道確定了就義無反顧
          posts - 1, comments - 7, trackbacks - 0, articles - 89

          Oracle SQL經驗積累

          Posted on 2009-08-04 14:58 sailor 閱讀(187) 評論(0)  編輯  收藏 所屬分類: oracle
           1、恢復表里被刪除的數據    
            今天不小心刪除了oracle里的數據,且commit了。在網上查了下,可以把數據恢復到以前某個時間點。
          insert into cd_access_right
            
          select *
              
          from (select *
                      
          from cd_access_right as of timestamp to_timestamp('2009-8-2 16:42:50''yyyy-mm-dd hh24:mi:ss'));

          2、一次性插入多條SQL語句
           1insert into cd_access_right_role
           2  (access_right_role_id,
           3   create_user,
           4   create_user_name,
           5   create_time,
           6   last_update_user,
           7   last_update_user_name,
           8   last_update_time,
           9   org_id,
          10   system_status,
          11   record_version,
          12   access_right_code)
          13  select 
          14     cd_access_right_role_seq.nextval,
          15     'admin',
          16     '管理員',
          17     to_date('2009-8-3 16:42:50''yyyy-mm-dd hh24:mi:ss'),
          18     'admin',
          19     '管理員',
          20     to_date('2009-8-3 16:42:50''yyyy-mm-dd hh24:mi:ss'),
          21     '001',
          22     '0',
          23     1,
          24     access_right_code
          25    from (
          26         select 
          27           'M1' as access_right_code
          28          from 
          29           dual
          30          union 
          31          select 
          32           'M2' as access_right_code
          33          from 
          34           dual       
          35    )

          第14-23 要插入的常量;
          第26-34 插入的動態變量

          3、恢復被刪除的表
            FLASHBACK TABLE CD_USER TO BEFORE DROP
          主站蜘蛛池模板: 怀化市| 抚松县| 四平市| 新巴尔虎右旗| 马关县| 务川| 曲松县| 临泽县| 陆川县| 商丘市| 阿鲁科尔沁旗| 米脂县| 扎兰屯市| 陆河县| 洮南市| 广昌县| 林芝县| 谢通门县| 琼海市| 连南| 蒙自县| 巴东县| 石台县| 五常市| 体育| 东城区| 格尔木市| 华宁县| 郓城县| 高青县| 贵德县| 宁远县| 三台县| 修武县| 英吉沙县| 宁明县| 莫力| 上虞市| 郴州市| 东乡| 横峰县|