Bo's Oracle Station

查看: 1204|回复: 0

第53和54次:2014-10-25

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-10-29 16:28:26 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2014-11-1 20:06 编辑

2014-10-25-A.txt
  1. [root@station90 ~]# su - oracle
  2. [oracle@station90 ~]$ emctl start dbconsole
  3. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  4. Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
  5. https://station90.example.com:1158/em/console/aboutApplication
  6. Starting Oracle Enterprise Manager 11g Database Control ..... started.
  7. ------------------------------------------------------------------
  8. Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
  9. [oracle@station90 ~]$ sqlplus /nolog

  10. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 09:25:51 2014

  11. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  12. SQL> conn hr/oracle_4U
  13. Connected.
  14. SQL> create table t05110_a( a timestamp) ;

  15. Table created.

  16. SQL> insert into t05110_a values ( systimestamp) ;

  17. 1 row created.

  18. SQL> commitl
  19. SP2-0042: unknown command "commitl" - rest of line ignored.
  20. SQL> commit;

  21. Commit complete.

  22. SQL> select  *  from t05110_a;

  23. A
  24. ---------------------------------------------------------------------------
  25. 25-OCT-14 09.26.38.282493 AM

  26. SQL> alter  table t05110_a  modify ( a timestamp(9));

  27. Table altered.

  28. SQL> insert into t05110_a values ( systimestamp) ;

  29. 1 row created.

  30. SQL> commit;

  31. Commit complete.

  32. SQL> select  * from t05110_a;

  33. A
  34. ---------------------------------------------------------------------------
  35. 25-OCT-14 09.26.38.282493000 AM
  36. 25-OCT-14 09.28.26.877417000 AM

  37. SQL> create table t05110_b ( a  INTERVAL YEAR TO MONTH
  38.   2  ) ;
  39. create table t05110_b ( a  INTERVAL YEAR TO MONTH
  40.              *
  41. ERROR at line 1:
  42. ORA-00955: name is already used by an existing object


  43. SQL> create table t05110_z ( a  INTERVAL YEAR TO MONTH ) ;

  44. Table created.

  45. SQL> insert into t05110_z values ( interval '99-1' YEAR TO MONTH  ) ;

  46. 1 row created.

  47. SQL> commit;

  48. Commit complete.

  49. SQL> select sysdate+a from t05110_z;

  50. SYSDATE+A
  51. ------------------
  52. 25-NOV-13

  53. SQL> select to_char(sysdate+a,'YYYY-MM-DD') from t05110_z;

  54. TO_CHAR(SY
  55. ----------
  56. 2113-11-25

  57. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  58. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  59.                                        *
  60. ERROR at line 1:
  61. ORA-01873: the leading precision of the interval is too small


  62. SQL> alter table t05110_z  modify ( a  INTERVAL YEAR(3) to MONTH ) ;

  63. Table altered.

  64. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  65. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  66.                                        *
  67. ERROR at line 1:
  68. ORA-01873: the leading precision of the interval is too small


  69. SQL> insert into t05110_z values ( interval '100-1' YEAR(3) TO MONTH  ) ;

  70. 1 row created.

  71. SQL> commit;

  72. Commit complete.

  73. SQL> insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  ) ;
  74. insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  )
  75.                               *
  76. ERROR at line 1:
  77. ORA-01873: the leading precision of the interval is too small


  78. SQL> create table t05110_y( a  interval day to second ) ;

  79. Table created.

  80. SQL> insert into t05110_y  values ( interval '10 1:1:1.1'  day to second ) ;

  81. 1 row created.

  82. SQL> commit;

  83. Commit complete.

  84. SQL> select  sysdate+a  from t05110_y;

  85. SYSDATE+A
  86. ------------------
  87. 04-NOV-14

  88. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'    )  from t05110_y;
  89. select        to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'          )  from t05110_y
  90.                            *
  91. ERROR at line 1:
  92. ORA-01821: date format not recognized


  93. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SS'    )  from t05110_y;

  94. TO_CHAR(SYSDATE+A,'
  95. -------------------
  96. 2014-11-04:10:41:33

  97. SQL> insert into t05110_y  values ( interval '10 1:1:1.111'  day to second )
  98.   2  ;

  99. 1 row created.

  100. SQL> insert into t05110_y  values ( interval '10 1:1:1.1111'  day to second )
  101.   2  ;

  102. 1 row created.

  103. SQL> insert into t05110_y  values ( interval '10 1:1:1.111111111'  day to second )
  104.   2  ;

  105. 1 row created.

  106. SQL> commit;

  107. Commit complete.

  108. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  109.   2  ;
  110. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  111.                                         *
  112. ERROR at line 1:
  113. ORA-01873: the leading precision of the interval is too small


  114. SQL> alter table t05110_y  modify ( a  interval day (3)  to second ) ;

  115. Table altered.

  116. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second );
  117. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  118.                                         *
  119. ERROR at line 1:
  120. ORA-01873: the leading precision of the interval is too small


  121. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day(3)  to second );

  122. 1 row created.

  123. SQL> commit;

  124. Commit complete.

  125. SQL>




















  126. [root@station90 ~]# su - oracle
  127. [oracle@station90 ~]$ emctl start dbconsole
  128. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  129. Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
  130. https://station90.example.com:1158/em/console/aboutApplication
  131. Starting Oracle Enterprise Manager 11g Database Control ..... started.
  132. ------------------------------------------------------------------
  133. Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
  134. [oracle@station90 ~]$ sqlplus /nolog

  135. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 09:25:51 2014

  136. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  137. SQL> conn hr/oracle_4U
  138. Connected.
  139. SQL> create table t05110_a( a timestamp) ;

  140. Table created.

  141. SQL> insert into t05110_a values ( systimestamp) ;

  142. 1 row created.

  143. SQL> commitl
  144. SP2-0042: unknown command "commitl" - rest of line ignored.
  145. SQL> commit;

  146. Commit complete.

  147. SQL> select  *  from t05110_a;

  148. A
  149. ---------------------------------------------------------------------------
  150. 25-OCT-14 09.26.38.282493 AM

  151. SQL> alter  table t05110_a  modify ( a timestamp(9));

  152. Table altered.

  153. SQL> insert into t05110_a values ( systimestamp) ;

  154. 1 row created.

  155. SQL> commit;

  156. Commit complete.

  157. SQL> select  * from t05110_a;

  158. A
  159. ---------------------------------------------------------------------------
  160. 25-OCT-14 09.26.38.282493000 AM
  161. 25-OCT-14 09.28.26.877417000 AM

  162. SQL> create table t05110_b ( a  INTERVAL YEAR TO MONTH
  163.   2  ) ;
  164. create table t05110_b ( a  INTERVAL YEAR TO MONTH
  165.              *
  166. ERROR at line 1:
  167. ORA-00955: name is already used by an existing object


  168. SQL> create table t05110_z ( a  INTERVAL YEAR TO MONTH ) ;

  169. Table created.

  170. SQL> insert into t05110_z values ( interval '99-1' YEAR TO MONTH  ) ;

  171. 1 row created.

  172. SQL> commit;

  173. Commit complete.

  174. SQL> select sysdate+a from t05110_z;

  175. SYSDATE+A
  176. ------------------
  177. 25-NOV-13

  178. SQL> select to_char(sysdate+a,'YYYY-MM-DD') from t05110_z;

  179. TO_CHAR(SY
  180. ----------
  181. 2113-11-25

  182. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  183. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  184.                                        *
  185. ERROR at line 1:
  186. ORA-01873: the leading precision of the interval is too small


  187. SQL> alter table t05110_z  modify ( a  INTERVAL YEAR(3) to MONTH ) ;

  188. Table altered.

  189. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  190. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  191.                                        *
  192. ERROR at line 1:
  193. ORA-01873: the leading precision of the interval is too small


  194. SQL> insert into t05110_z values ( interval '100-1' YEAR(3) TO MONTH  ) ;

  195. 1 row created.

  196. SQL> commit;

  197. Commit complete.

  198. SQL> insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  ) ;
  199. insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  )
  200.                               *
  201. ERROR at line 1:
  202. ORA-01873: the leading precision of the interval is too small


  203. SQL> create table t05110_y( a  interval day to second ) ;

  204. Table created.

  205. SQL> insert into t05110_y  values ( interval '10 1:1:1.1'  day to second ) ;

  206. 1 row created.

  207. SQL> commit;

  208. Commit complete.

  209. SQL> select  sysdate+a  from t05110_y;

  210. SYSDATE+A
  211. ------------------
  212. 04-NOV-14

  213. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'    )  from t05110_y;
  214. select        to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'          )  from t05110_y
  215.                            *
  216. ERROR at line 1:
  217. ORA-01821: date format not recognized


  218. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SS'    )  from t05110_y;

  219. TO_CHAR(SYSDATE+A,'
  220. -------------------
  221. 2014-11-04:10:41:33

  222. SQL> insert into t05110_y  values ( interval '10 1:1:1.111'  day to second )
  223.   2  ;

  224. 1 row created.

  225. SQL> insert into t05110_y  values ( interval '10 1:1:1.1111'  day to second )
  226.   2  ;

  227. 1 row created.

  228. SQL> insert into t05110_y  values ( interval '10 1:1:1.111111111'  day to second )
  229.   2  ;

  230. 1 row created.

  231. SQL> commit;

  232. Commit complete.

  233. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  234.   2  ;
  235. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  236.                                         *
  237. ERROR at line 1:
  238. ORA-01873: the leading precision of the interval is too small


  239. SQL> alter table t05110_y  modify ( a  interval day (3)  to second ) ;

  240. Table altered.

  241. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second );
  242. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  243.                                         *
  244. ERROR at line 1:
  245. ORA-01873: the leading precision of the interval is too small


  246. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day(3)  to second );

  247. 1 row created.

  248. SQL> commit;

  249. Commit complete.

  250. SQL>




  251. [root@station90 ~]# su - oracle
  252. [oracle@station90 ~]$ emctl start dbconsole
  253. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  254. Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
  255. https://station90.example.com:1158/em/console/aboutApplication
  256. Starting Oracle Enterprise Manager 11g Database Control ..... started.
  257. ------------------------------------------------------------------
  258. Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
  259. [oracle@station90 ~]$ sqlplus /nolog

  260. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 09:25:51 2014

  261. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  262. SQL> conn hr/oracle_4U
  263. Connected.
  264. SQL> create table t05110_a( a timestamp) ;

  265. Table created.

  266. SQL> insert into t05110_a values ( systimestamp) ;

  267. 1 row created.

  268. SQL> commitl
  269. SP2-0042: unknown command "commitl" - rest of line ignored.
  270. SQL> commit;

  271. Commit complete.

  272. SQL> select  *  from t05110_a;

  273. A
  274. ---------------------------------------------------------------------------
  275. 25-OCT-14 09.26.38.282493 AM

  276. SQL> alter  table t05110_a  modify ( a timestamp(9));

  277. Table altered.

  278. SQL> insert into t05110_a values ( systimestamp) ;

  279. 1 row created.

  280. SQL> commit;

  281. Commit complete.

  282. SQL> select  * from t05110_a;

  283. A
  284. ---------------------------------------------------------------------------
  285. 25-OCT-14 09.26.38.282493000 AM
  286. 25-OCT-14 09.28.26.877417000 AM

  287. SQL> create table t05110_b ( a  INTERVAL YEAR TO MONTH
  288.   2  ) ;
  289. create table t05110_b ( a  INTERVAL YEAR TO MONTH
  290.              *
  291. ERROR at line 1:
  292. ORA-00955: name is already used by an existing object


  293. SQL> create table t05110_z ( a  INTERVAL YEAR TO MONTH ) ;

  294. Table created.

  295. SQL> insert into t05110_z values ( interval '99-1' YEAR TO MONTH  ) ;

  296. 1 row created.

  297. SQL> commit;

  298. Commit complete.

  299. SQL> select sysdate+a from t05110_z;

  300. SYSDATE+A
  301. ------------------
  302. 25-NOV-13

  303. SQL> select to_char(sysdate+a,'YYYY-MM-DD') from t05110_z;

  304. TO_CHAR(SY
  305. ----------
  306. 2113-11-25

  307. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  308. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  309.                                        *
  310. ERROR at line 1:
  311. ORA-01873: the leading precision of the interval is too small


  312. SQL> alter table t05110_z  modify ( a  INTERVAL YEAR(3) to MONTH ) ;

  313. Table altered.

  314. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  315. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  316.                                        *
  317. ERROR at line 1:
  318. ORA-01873: the leading precision of the interval is too small


  319. SQL> insert into t05110_z values ( interval '100-1' YEAR(3) TO MONTH  ) ;

  320. 1 row created.

  321. SQL> commit;

  322. Commit complete.

  323. SQL> insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  ) ;
  324. insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  )
  325.                               *
  326. ERROR at line 1:
  327. ORA-01873: the leading precision of the interval is too small


  328. SQL> create table t05110_y( a  interval day to second ) ;

  329. Table created.

  330. SQL> insert into t05110_y  values ( interval '10 1:1:1.1'  day to second ) ;

  331. 1 row created.

  332. SQL> commit;

  333. Commit complete.

  334. SQL> select  sysdate+a  from t05110_y;

  335. SYSDATE+A
  336. ------------------
  337. 04-NOV-14

  338. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'    )  from t05110_y;
  339. select        to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'          )  from t05110_y
  340.                            *
  341. ERROR at line 1:
  342. ORA-01821: date format not recognized


  343. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SS'    )  from t05110_y;

  344. TO_CHAR(SYSDATE+A,'
  345. -------------------
  346. 2014-11-04:10:41:33

  347. SQL> insert into t05110_y  values ( interval '10 1:1:1.111'  day to second )
  348.   2  ;

  349. 1 row created.

  350. SQL> insert into t05110_y  values ( interval '10 1:1:1.1111'  day to second )
  351.   2  ;

  352. 1 row created.

  353. SQL> insert into t05110_y  values ( interval '10 1:1:1.111111111'  day to second )
  354.   2  ;

  355. 1 row created.

  356. SQL> commit;

  357. Commit complete.

  358. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  359.   2  ;
  360. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  361.                                         *
  362. ERROR at line 1:
  363. ORA-01873: the leading precision of the interval is too small


  364. SQL> alter table t05110_y  modify ( a  interval day (3)  to second ) ;

  365. Table altered.

  366. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second );
  367. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  368.                                         *
  369. ERROR at line 1:
  370. ORA-01873: the leading precision of the interval is too small


  371. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day(3)  to second );

  372. 1 row created.

  373. SQL> commit;

  374. Commit complete.

  375. SQL>



  376. [root@station90 ~]# su - oracle
  377. [oracle@station90 ~]$ emctl start dbconsole
  378. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  379. Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
  380. https://station90.example.com:1158/em/console/aboutApplication
  381. Starting Oracle Enterprise Manager 11g Database Control ..... started.
  382. ------------------------------------------------------------------
  383. Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
  384. [oracle@station90 ~]$ sqlplus /nolog

  385. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 09:25:51 2014

  386. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  387. SQL> conn hr/oracle_4U
  388. Connected.
  389. SQL> create table t05110_a( a timestamp) ;

  390. Table created.

  391. SQL> insert into t05110_a values ( systimestamp) ;

  392. 1 row created.

  393. SQL> commitl
  394. SP2-0042: unknown command "commitl" - rest of line ignored.
  395. SQL> commit;

  396. Commit complete.

  397. SQL> select  *  from t05110_a;

  398. A
  399. ---------------------------------------------------------------------------
  400. 25-OCT-14 09.26.38.282493 AM

  401. SQL> alter  table t05110_a  modify ( a timestamp(9));

  402. Table altered.

  403. SQL> insert into t05110_a values ( systimestamp) ;

  404. 1 row created.

  405. SQL> commit;

  406. Commit complete.

  407. SQL> select  * from t05110_a;

  408. A
  409. ---------------------------------------------------------------------------
  410. 25-OCT-14 09.26.38.282493000 AM
  411. 25-OCT-14 09.28.26.877417000 AM

  412. SQL> create table t05110_b ( a  INTERVAL YEAR TO MONTH
  413.   2  ) ;
  414. create table t05110_b ( a  INTERVAL YEAR TO MONTH
  415.              *
  416. ERROR at line 1:
  417. ORA-00955: name is already used by an existing object


  418. SQL> create table t05110_z ( a  INTERVAL YEAR TO MONTH ) ;

  419. Table created.

  420. SQL> insert into t05110_z values ( interval '99-1' YEAR TO MONTH  ) ;

  421. 1 row created.

  422. SQL> commit;

  423. Commit complete.

  424. SQL> select sysdate+a from t05110_z;

  425. SYSDATE+A
  426. ------------------
  427. 25-NOV-13

  428. SQL> select to_char(sysdate+a,'YYYY-MM-DD') from t05110_z;

  429. TO_CHAR(SY
  430. ----------
  431. 2113-11-25

  432. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  433. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  434.                                        *
  435. ERROR at line 1:
  436. ORA-01873: the leading precision of the interval is too small


  437. SQL> alter table t05110_z  modify ( a  INTERVAL YEAR(3) to MONTH ) ;

  438. Table altered.

  439. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  440. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  441.                                        *
  442. ERROR at line 1:
  443. ORA-01873: the leading precision of the interval is too small


  444. SQL> insert into t05110_z values ( interval '100-1' YEAR(3) TO MONTH  ) ;

  445. 1 row created.

  446. SQL> commit;

  447. Commit complete.

  448. SQL> insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  ) ;
  449. insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  )
  450.                               *
  451. ERROR at line 1:
  452. ORA-01873: the leading precision of the interval is too small


  453. SQL> create table t05110_y( a  interval day to second ) ;

  454. Table created.

  455. SQL> insert into t05110_y  values ( interval '10 1:1:1.1'  day to second ) ;

  456. 1 row created.

  457. SQL> commit;

  458. Commit complete.

  459. SQL> select  sysdate+a  from t05110_y;

  460. SYSDATE+A
  461. ------------------
  462. 04-NOV-14

  463. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'    )  from t05110_y;
  464. select        to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'          )  from t05110_y
  465.                            *
  466. ERROR at line 1:
  467. ORA-01821: date format not recognized


  468. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SS'    )  from t05110_y;

  469. TO_CHAR(SYSDATE+A,'
  470. -------------------
  471. 2014-11-04:10:41:33

  472. SQL> insert into t05110_y  values ( interval '10 1:1:1.111'  day to second )
  473.   2  ;

  474. 1 row created.

  475. SQL> insert into t05110_y  values ( interval '10 1:1:1.1111'  day to second )
  476.   2  ;

  477. 1 row created.

  478. SQL> insert into t05110_y  values ( interval '10 1:1:1.111111111'  day to second )
  479.   2  ;

  480. 1 row created.

  481. SQL> commit;

  482. Commit complete.

  483. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  484.   2  ;
  485. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  486.                                         *
  487. ERROR at line 1:
  488. ORA-01873: the leading precision of the interval is too small


  489. SQL> alter table t05110_y  modify ( a  interval day (3)  to second ) ;

  490. Table altered.

  491. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second );
  492. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  493.                                         *
  494. ERROR at line 1:
  495. ORA-01873: the leading precision of the interval is too small


  496. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day(3)  to second );

  497. 1 row created.

  498. SQL> commit;

  499. Commit complete.

  500. SQL>





















































复制代码


2014-10-25-B.txt
  1. [root@station90 ~]# su - oracle
  2. [oracle@station90 ~]$ emctl start dbconsole
  3. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  4. Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
  5. https://station90.example.com:1158/em/console/aboutApplication
  6. Starting Oracle Enterprise Manager 11g Database Control ..... started.
  7. ------------------------------------------------------------------
  8. Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
  9. [oracle@station90 ~]$ sqlplus /nolog

  10. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 09:25:51 2014

  11. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  12. SQL> conn hr/oracle_4U
  13. Connected.
  14. SQL> create table t05110_a( a timestamp) ;

  15. Table created.

  16. SQL> insert into t05110_a values ( systimestamp) ;

  17. 1 row created.

  18. SQL> commitl
  19. SP2-0042: unknown command "commitl" - rest of line ignored.
  20. SQL> commit;

  21. Commit complete.

  22. SQL> select  *  from t05110_a;

  23. A
  24. ---------------------------------------------------------------------------
  25. 25-OCT-14 09.26.38.282493 AM

  26. SQL> alter  table t05110_a  modify ( a timestamp(9));

  27. Table altered.

  28. SQL> insert into t05110_a values ( systimestamp) ;

  29. 1 row created.

  30. SQL> commit;

  31. Commit complete.

  32. SQL> select  * from t05110_a;

  33. A
  34. ---------------------------------------------------------------------------
  35. 25-OCT-14 09.26.38.282493000 AM
  36. 25-OCT-14 09.28.26.877417000 AM

  37. SQL> create table t05110_b ( a  INTERVAL YEAR TO MONTH
  38.   2  ) ;
  39. create table t05110_b ( a  INTERVAL YEAR TO MONTH
  40.              *
  41. ERROR at line 1:
  42. ORA-00955: name is already used by an existing object


  43. SQL> create table t05110_z ( a  INTERVAL YEAR TO MONTH ) ;

  44. Table created.

  45. SQL> insert into t05110_z values ( interval '99-1' YEAR TO MONTH  ) ;

  46. 1 row created.

  47. SQL> commit;

  48. Commit complete.

  49. SQL> select sysdate+a from t05110_z;

  50. SYSDATE+A
  51. ------------------
  52. 25-NOV-13

  53. SQL> select to_char(sysdate+a,'YYYY-MM-DD') from t05110_z;

  54. TO_CHAR(SY
  55. ----------
  56. 2113-11-25

  57. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  58. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  59.                                        *
  60. ERROR at line 1:
  61. ORA-01873: the leading precision of the interval is too small


  62. SQL> alter table t05110_z  modify ( a  INTERVAL YEAR(3) to MONTH ) ;

  63. Table altered.

  64. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  65. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  66.                                        *
  67. ERROR at line 1:
  68. ORA-01873: the leading precision of the interval is too small


  69. SQL> insert into t05110_z values ( interval '100-1' YEAR(3) TO MONTH  ) ;

  70. 1 row created.

  71. SQL> commit;

  72. Commit complete.

  73. SQL> insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  ) ;
  74. insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  )
  75.                               *
  76. ERROR at line 1:
  77. ORA-01873: the leading precision of the interval is too small


  78. SQL> create table t05110_y( a  interval day to second ) ;

  79. Table created.

  80. SQL> insert into t05110_y  values ( interval '10 1:1:1.1'  day to second ) ;

  81. 1 row created.

  82. SQL> commit;

  83. Commit complete.

  84. SQL> select  sysdate+a  from t05110_y;

  85. SYSDATE+A
  86. ------------------
  87. 04-NOV-14

  88. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'    )  from t05110_y;
  89. select        to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'          )  from t05110_y
  90.                            *
  91. ERROR at line 1:
  92. ORA-01821: date format not recognized


  93. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SS'    )  from t05110_y;

  94. TO_CHAR(SYSDATE+A,'
  95. -------------------
  96. 2014-11-04:10:41:33

  97. SQL> insert into t05110_y  values ( interval '10 1:1:1.111'  day to second )
  98.   2  ;

  99. 1 row created.

  100. SQL> insert into t05110_y  values ( interval '10 1:1:1.1111'  day to second )
  101.   2  ;

  102. 1 row created.

  103. SQL> insert into t05110_y  values ( interval '10 1:1:1.111111111'  day to second )
  104.   2  ;

  105. 1 row created.

  106. SQL> commit;

  107. Commit complete.

  108. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  109.   2  ;
  110. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  111.                                         *
  112. ERROR at line 1:
  113. ORA-01873: the leading precision of the interval is too small


  114. SQL> alter table t05110_y  modify ( a  interval day (3)  to second ) ;

  115. Table altered.

  116. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second );
  117. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  118.                                         *
  119. ERROR at line 1:
  120. ORA-01873: the leading precision of the interval is too small


  121. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day(3)  to second );

  122. 1 row created.

  123. SQL> commit;

  124. Commit complete.

  125. SQL> create table t05110_x( a number , b number ) ;

  126. Table created.

  127. SQL> alter table t05110_x add constraint chk_t05110_x  check ( a +b =1 ) ;

  128. Table altered.

  129. SQL> insert into t05110_x  values ( 0.5, 0.5 ) ;

  130. 1 row created.

  131. SQL> insert into t05110_x  values ( 0.5, 0.4 ) ;
  132. insert into t05110_x  values ( 0.5, 0.4 )
  133. *
  134. ERROR at line 1:
  135. ORA-02290: check constraint (HR.CHK_T05110_X) violated


  136. SQL> create table t05110_w ( a  number );

  137. Table created.

  138. SQL> insert into t05110_w (1);
  139. insert into t05110_w (1)
  140.                       *
  141. ERROR at line 1:
  142. ORA-00928: missing SELECT keyword


  143. SQL> insert into t05110_w  values (1);

  144. 1 row created.

  145. SQL> commit;

  146. Commit complete.

  147. SQL> update t05110_w set a=2 where a=1;

  148. 1 row updated.

  149. SQL> commit;

  150. Commit complete.

  151. SQL> update t05110_w set a=1 where a=2;

  152. 1 row updated.

  153. SQL> commit;

  154. Commit complete.

  155. SQL> select  * from t05110_w;

  156.          A
  157. ----------
  158.          1

  159. SQL> update t05110_w set a=2;

  160. 1 row updated.

  161. SQL> commit;

  162. Commit complete.

  163. SQL> update t05110_w set a=1;
  164. update t05110_w set a=1
  165.        *
  166. ERROR at line 1:
  167. ORA-21000: error number argument to raise_application_error of 20001 is out of
  168. range
  169. ORA-06512: at "HR.TRG1", line 4
  170. ORA-04088: error during execution of trigger 'HR.TRG1'


  171. SQL> update t05110_w set a=1;
  172. update t05110_w set a=1
  173.        *
  174. ERROR at line 1:
  175. ORA-20001: YOU ARE WRONG
  176. ORA-06512: at "HR.TRG1", line 4
  177. ORA-04088: error during execution of trigger 'HR.TRG1'


  178. SQL> create table t05110_u( a  number ) ;

  179. Table created.

  180. SQL> insert into t05110_u values (1) ;

  181. 1 row created.

  182. SQL> commit;

  183. Commit complete.

  184. SQL> alter  table t05110_u   rename column  a to b;

  185. Table altered.

  186. SQL> select  * from t05110_u;

  187.          B
  188. ----------
  189.          1

  190. SQL> rename t05110_u to t05110_v;

  191. Table renamed.

  192. SQL> select  * from t05110_v;

  193.          B
  194. ----------
  195.          1

  196. SQL> update t05110_v set b=2;

  197. 1 row updated.

  198. SQL> commit;

  199. Commit complete.

  200. SQL> alter table t05110_v  read only;

  201. Table altered.

  202. SQL> update t05110_v set b=3;
  203. update t05110_v set b=3
  204.        *
  205. ERROR at line 1:
  206. ORA-12081: update operation not allowed on table "HR"."T05110_V"


  207. SQL> alter table t05110_v  rename b to c;
  208. alter table t05110_v  rename b to c
  209.                              *
  210. ERROR at line 1:
  211. ORA-14155: missing PARTITION or SUBPARTITION keyword


  212. SQL> alter table t05110_v  rename   column b to c;
  213. alter table t05110_v  rename   column b to c
  214. *
  215. ERROR at line 1:
  216. ORA-12081: update operation not allowed on table "HR"."T05110_V"


  217. SQL> alter table t05110_v  add constraint chk1  check ( a >1000) ;
  218. alter table t05110_v  add constraint chk1  check ( a >1000)
  219.                                                    *
  220. ERROR at line 1:
  221. ORA-00904: "A": invalid identifier


  222. SQL> alter table t05110_v  add constraint chk1  check ( b  >1000) ;
  223. alter table t05110_v  add constraint chk1  check ( b  >1000)
  224.                                      *
  225. ERROR at line 1:
  226. ORA-02293: cannot validate (HR.CHK1) - check constraint violated


  227. SQL> alter table t05110_v  add constraint chk1  check ( b  <1000) ;

  228. Table altered.

  229. SQL> alter table t05110_v  read  write;

  230. Table altered.

  231. SQL> update t05110_v set b=3;

  232. 1 row updated.

  233. SQL> commit;

  234. Commit complete.

  235. SQL>





  236. [root@station90 ~]# su - oracle
  237. [oracle@station90 ~]$ emctl start dbconsole
  238. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  239. Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
  240. https://station90.example.com:1158/em/console/aboutApplication
  241. Starting Oracle Enterprise Manager 11g Database Control ..... started.
  242. ------------------------------------------------------------------
  243. Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
  244. [oracle@station90 ~]$ sqlplus /nolog

  245. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 09:25:51 2014

  246. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  247. SQL> conn hr/oracle_4U
  248. Connected.
  249. SQL> create table t05110_a( a timestamp) ;

  250. Table created.

  251. SQL> insert into t05110_a values ( systimestamp) ;

  252. 1 row created.

  253. SQL> commitl
  254. SP2-0042: unknown command "commitl" - rest of line ignored.
  255. SQL> commit;

  256. Commit complete.

  257. SQL> select  *  from t05110_a;

  258. A
  259. ---------------------------------------------------------------------------
  260. 25-OCT-14 09.26.38.282493 AM

  261. SQL> alter  table t05110_a  modify ( a timestamp(9));

  262. Table altered.

  263. SQL> insert into t05110_a values ( systimestamp) ;

  264. 1 row created.

  265. SQL> commit;

  266. Commit complete.

  267. SQL> select  * from t05110_a;

  268. A
  269. ---------------------------------------------------------------------------
  270. 25-OCT-14 09.26.38.282493000 AM
  271. 25-OCT-14 09.28.26.877417000 AM

  272. SQL> create table t05110_b ( a  INTERVAL YEAR TO MONTH
  273.   2  ) ;
  274. create table t05110_b ( a  INTERVAL YEAR TO MONTH
  275.              *
  276. ERROR at line 1:
  277. ORA-00955: name is already used by an existing object


  278. SQL> create table t05110_z ( a  INTERVAL YEAR TO MONTH ) ;

  279. Table created.

  280. SQL> insert into t05110_z values ( interval '99-1' YEAR TO MONTH  ) ;

  281. 1 row created.

  282. SQL> commit;

  283. Commit complete.

  284. SQL> select sysdate+a from t05110_z;

  285. SYSDATE+A
  286. ------------------
  287. 25-NOV-13

  288. SQL> select to_char(sysdate+a,'YYYY-MM-DD') from t05110_z;

  289. TO_CHAR(SY
  290. ----------
  291. 2113-11-25

  292. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  293. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  294.                                        *
  295. ERROR at line 1:
  296. ORA-01873: the leading precision of the interval is too small


  297. SQL> alter table t05110_z  modify ( a  INTERVAL YEAR(3) to MONTH ) ;

  298. Table altered.

  299. SQL> insert into t05110_z values ( interval '100-1' YEAR TO MONTH  ) ;
  300. insert into t05110_z values ( interval '100-1' YEAR TO MONTH  )
  301.                                        *
  302. ERROR at line 1:
  303. ORA-01873: the leading precision of the interval is too small


  304. SQL> insert into t05110_z values ( interval '100-1' YEAR(3) TO MONTH  ) ;

  305. 1 row created.

  306. SQL> commit;

  307. Commit complete.

  308. SQL> insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  ) ;
  309. insert into t05110_z values ( interval '1000-1' YEAR(4) TO MONTH  )
  310.                               *
  311. ERROR at line 1:
  312. ORA-01873: the leading precision of the interval is too small


  313. SQL> create table t05110_y( a  interval day to second ) ;

  314. Table created.

  315. SQL> insert into t05110_y  values ( interval '10 1:1:1.1'  day to second ) ;

  316. 1 row created.

  317. SQL> commit;

  318. Commit complete.

  319. SQL> select  sysdate+a  from t05110_y;

  320. SYSDATE+A
  321. ------------------
  322. 04-NOV-14

  323. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'    )  from t05110_y;
  324. select        to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SSSSSS'          )  from t05110_y
  325.                            *
  326. ERROR at line 1:
  327. ORA-01821: date format not recognized


  328. SQL> select  to_char(sysdate+a, 'YYYY-MM-DD:HH24:MI:SS'    )  from t05110_y;

  329. TO_CHAR(SYSDATE+A,'
  330. -------------------
  331. 2014-11-04:10:41:33

  332. SQL> insert into t05110_y  values ( interval '10 1:1:1.111'  day to second )
  333.   2  ;

  334. 1 row created.

  335. SQL> insert into t05110_y  values ( interval '10 1:1:1.1111'  day to second )
  336.   2  ;

  337. 1 row created.

  338. SQL> insert into t05110_y  values ( interval '10 1:1:1.111111111'  day to second )
  339.   2  ;

  340. 1 row created.

  341. SQL> commit;

  342. Commit complete.

  343. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  344.   2  ;
  345. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  346.                                         *
  347. ERROR at line 1:
  348. ORA-01873: the leading precision of the interval is too small


  349. SQL> alter table t05110_y  modify ( a  interval day (3)  to second ) ;

  350. Table altered.

  351. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second );
  352. insert into t05110_y  values ( interval '100 1:1:1.111111111'  day to second )
  353.                                         *
  354. ERROR at line 1:
  355. ORA-01873: the leading precision of the interval is too small


  356. SQL> insert into t05110_y  values ( interval '100 1:1:1.111111111'  day(3)  to second );

  357. 1 row created.

  358. SQL> commit;

  359. Commit complete.

  360. SQL> create table t05110_x( a number , b number ) ;

  361. Table created.

  362. SQL> alter table t05110_x add constraint chk_t05110_x  check ( a +b =1 ) ;

  363. Table altered.

  364. SQL> insert into t05110_x  values ( 0.5, 0.5 ) ;

  365. 1 row created.

  366. SQL> insert into t05110_x  values ( 0.5, 0.4 ) ;
  367. insert into t05110_x  values ( 0.5, 0.4 )
  368. *
  369. ERROR at line 1:
  370. ORA-02290: check constraint (HR.CHK_T05110_X) violated


  371. SQL> create table t05110_w ( a  number );

  372. Table created.

  373. SQL> insert into t05110_w (1);
  374. insert into t05110_w (1)
  375.                       *
  376. ERROR at line 1:
  377. ORA-00928: missing SELECT keyword


  378. SQL> insert into t05110_w  values (1);

  379. 1 row created.

  380. SQL> commit;

  381. Commit complete.

  382. SQL> update t05110_w set a=2 where a=1;

  383. 1 row updated.

  384. SQL> commit;

  385. Commit complete.

  386. SQL> update t05110_w set a=1 where a=2;

  387. 1 row updated.

  388. SQL> commit;

  389. Commit complete.

  390. SQL> select  * from t05110_w;

  391.          A
  392. ----------
  393.          1

  394. SQL> update t05110_w set a=2;

  395. 1 row updated.

  396. SQL> commit;

  397. Commit complete.

  398. SQL> update t05110_w set a=1;
  399. update t05110_w set a=1
  400.        *
  401. ERROR at line 1:
  402. ORA-21000: error number argument to raise_application_error of 20001 is out of
  403. range
  404. ORA-06512: at "HR.TRG1", line 4
  405. ORA-04088: error during execution of trigger 'HR.TRG1'


  406. SQL> update t05110_w set a=1;
  407. update t05110_w set a=1
  408.        *
  409. ERROR at line 1:
  410. ORA-20001: YOU ARE WRONG
  411. ORA-06512: at "HR.TRG1", line 4
  412. ORA-04088: error during execution of trigger 'HR.TRG1'


  413. SQL> create table t05110_u( a  number ) ;

  414. Table created.

  415. SQL> insert into t05110_u values (1) ;

  416. 1 row created.

  417. SQL> commit;

  418. Commit complete.

  419. SQL> alter  table t05110_u   rename column  a to b;

  420. Table altered.

  421. SQL> select  * from t05110_u;

  422.          B
  423. ----------
  424.          1

  425. SQL> rename t05110_u to t05110_v;

  426. Table renamed.

  427. SQL> select  * from t05110_v;

  428.          B
  429. ----------
  430.          1

  431. SQL> update t05110_v set b=2;

  432. 1 row updated.

  433. SQL> commit;

  434. Commit complete.

  435. SQL> alter table t05110_v  read only;

  436. Table altered.

  437. SQL> update t05110_v set b=3;
  438. update t05110_v set b=3
  439.        *
  440. ERROR at line 1:
  441. ORA-12081: update operation not allowed on table "HR"."T05110_V"


  442. SQL> alter table t05110_v  rename b to c;
  443. alter table t05110_v  rename b to c
  444.                              *
  445. ERROR at line 1:
  446. ORA-14155: missing PARTITION or SUBPARTITION keyword


  447. SQL> alter table t05110_v  rename   column b to c;
  448. alter table t05110_v  rename   column b to c
  449. *
  450. ERROR at line 1:
  451. ORA-12081: update operation not allowed on table "HR"."T05110_V"


  452. SQL> alter table t05110_v  add constraint chk1  check ( a >1000) ;
  453. alter table t05110_v  add constraint chk1  check ( a >1000)
  454.                                                    *
  455. ERROR at line 1:
  456. ORA-00904: "A": invalid identifier


  457. SQL> alter table t05110_v  add constraint chk1  check ( b  >1000) ;
  458. alter table t05110_v  add constraint chk1  check ( b  >1000)
  459.                                      *
  460. ERROR at line 1:
  461. ORA-02293: cannot validate (HR.CHK1) - check constraint violated


  462. SQL> alter table t05110_v  add constraint chk1  check ( b  <1000) ;

  463. Table altered.

  464. SQL> alter table t05110_v  read  write;

  465. Table altered.

  466. SQL> update t05110_v set b=3;

  467. 1 row updated.

  468. SQL> commit;

  469. Commit complete.

  470. SQL>



































复制代码

2014-10-25-C.txt
  1. drop trigger trg1;

  2. create or replace trigger trg1
  3. after update of a on t05110_w
  4. referencing new as new old as old
  5. for each row
  6. begin
  7.     if :old.a  > :new.a
  8.       then
  9.           raise_application_error('-20001','YOU ARE WRONG');
  10.         end if;
  11.     end;
复制代码

2014-10-25-D.txt
  1. SQL> select seq1.nextval from dual;

  2.    NEXTVAL
  3. ----------
  4.          2

  5. SQL> insert into t05111_a  values ( seq1.nextval) ;

  6. 1 row created.

  7. SQL> commit;

  8. Commit complete.

  9. SQL> select seq1.nextval from dual;

  10.    NEXTVAL
  11. ----------
  12.          4

  13. SQL> insert into t05111_a  values ( seq1.nextval) ;

  14. 1 row created.

  15. SQL> commit;

  16. Commit complete.

  17. SQL> select  * from t05111_a;

  18.          A
  19. ----------
  20.          1
  21.          3
  22.          5

  23. SQL> insert into t05111_a  values ( seq1.nextval) ;

  24. 1 row created.

  25. SQL> insert into t05111_a  values ( seq1.nextval) ;

  26. 1 row created.

  27. SQL> insert into t05111_a  values ( seq1.nextval) ;

  28. 1 row created.

  29. SQL> insert into t05111_a  values ( seq1.nextval) ;

  30. 1 row created.

  31. SQL> insert into t05111_a  values ( seq1.nextval) ;

  32. 1 row created.

  33. SQL> insert into t05111_a  values ( seq1.nextval) ;

  34. 1 row created.

  35. SQL> insert into t05111_a  values ( seq1.nextval) ;

  36. 1 row created.

  37. SQL> insert into t05111_a  values ( seq1.nextval) ;

  38. 1 row created.

  39. SQL> insert into t05111_a  values ( seq1.nextval) ;

  40. 1 row created.

  41. SQL> commit;

  42. Commit complete.

  43. SQL> select  * from t05111_a;

  44.          A
  45. ----------
  46.          1
  47.          3
  48.          5
  49.          6
  50.          7
  51.          8
  52.          9
  53.         10
  54.         11
  55.         12
  56.         13

  57.          A
  58. ----------
  59.         14

  60. 12 rows selected.

  61. SQL> insert into t05111_a  values ( seq1.nextval) ;

  62. 1 row created.

  63. SQL> insert into t05111_a  values ( seq1.nextval) ;

  64. 1 row created.

  65. SQL> insert into t05111_a  values ( seq1.nextval) ;

  66. 1 row created.

  67. SQL> insert into t05111_a  values ( seq1.nextval) ;

  68. 1 row created.

  69. SQL> insert into t05111_a  values ( seq1.nextval) ;

  70. 1 row created.

  71. SQL> select  * from t05111_a;

  72.          A
  73. ----------
  74.          1
  75.          3
  76.          5
  77.          6
  78.          7
  79.          8
  80.          9
  81.         10
  82.         11
  83.         12
  84.         13

  85.          A
  86. ----------
  87.         14
  88.         15
  89.         16
  90.         17
  91.         18
  92.         19

  93. 17 rows selected.

  94. SQL> insert into t05111_a  values ( seq1.nextval) ;

  95. 1 row created.

  96. SQL> commit;

  97. Commit complete.

  98. SQL> select  * from t05111_a;

  99.          A
  100. ----------
  101.          1
  102.          3
  103.          5
  104.          6
  105.          7
  106.          8
  107.          9
  108.         10
  109.         11
  110.         12
  111.         13

  112.          A
  113. ----------
  114.         14
  115.         15
  116.         16
  117.         17
  118.         18
  119.         19
  120.         20

  121. 18 rows selected.

  122. SQL> insert into t05111_a  values ( seq1.nextval) ;

  123. 1 row created.

  124. SQL> commit;

  125. Commit complete.

  126. SQL> conn / as sysdba
  127. Connected.
  128. SQL> shutdown abort
  129. ORACLE instance shut down.
  130. SQL> startup
  131. ORACLE instance started.

  132. Total System Global Area 6664212480 bytes
  133. Fixed Size                    2240944 bytes
  134. Variable Size                 3640659536 bytes
  135. Database Buffers         3003121664 bytes
  136. Redo Buffers                   18190336 bytes
  137. Database mounted.
  138. Database opened.
  139. SQL> conn hr/oracle_4U
  140. Connected.
  141. SQL> select  * from t05111_a;

  142.          A
  143. ----------
  144.          1
  145.          3
  146.          5
  147.          6
  148.          7
  149.          8
  150.          9
  151.         10
  152.         11
  153.         12
  154.         13

  155.          A
  156. ----------
  157.         14
  158.         15
  159.         16
  160.         17
  161.         18
  162.         19
  163.         20
  164.         21

  165. 19 rows selected.

  166. SQL> insert into t05111_a  values ( seq1.nextval) ;

  167. 1 row created.

  168. SQL> commit;

  169. Commit complete.

  170. SQL> select  * from t05111_a;

  171.          A
  172. ----------
  173.          1
  174.          3
  175.          5
  176.          6
  177.          7
  178.          8
  179.          9
  180.         10
  181.         11
  182.         12
  183.         13

  184.          A
  185. ----------
  186.         14
  187.         15
  188.         16
  189.         17
  190.         18
  191.         19
  192.         20
  193.         21
  194.         41

  195. 20 rows selected.

  196. SQL> shutdown immediate
  197. ORA-01031: insufficient privileges
  198. SQL> conn / as sysdba
  199. Connected.
  200. SQL> shutdown immediate
  201. Database closed.
  202. Database dismounted.
  203. ORACLE instance shut down.
  204. SQL> startup
  205. ORACLE instance started.

  206. Total System Global Area 6664212480 bytes
  207. Fixed Size                    2240944 bytes
  208. Variable Size                 3640659536 bytes
  209. Database Buffers         3003121664 bytes
  210. Redo Buffers                   18190336 bytes
  211. Database mounted.
  212. Database opened.
  213. SQL> conn hr/oracle_4U
  214. Connected.
  215. SQL> insert into t05111_a  values ( seq1.nextval) ;

  216. 1 row created.

  217. SQL> commit;

  218. Commit complete.

  219. SQL> select  * from t05111_a;

  220.          A
  221. ----------
  222.          1
  223.          3
  224.          5
  225.          6
  226.          7
  227.          8
  228.          9
  229.         10
  230.         11
  231.         12
  232.         13

  233.          A
  234. ----------
  235.         14
  236.         15
  237.         16
  238.         17
  239.         18
  240.         19
  241.         20
  242.         21
  243.         42
  244.         41

  245. 21 rows selected.

  246. SQL> alter  sequence seq1  order ;

  247. Sequence altered.

  248. SQL> alter  sequence seq1  maxvalue 100 ;

  249. Sequence altered.

  250. SQL> alter  sequence seq1  nocycle  ;

  251. Sequence altered.

  252. SQL> alter  sequence seq1  cycle  ;

  253. Sequence altered.

  254. SQL> alter  sequence seq1  increment by 10   ;
  255. alter  sequence seq1  increment by 10
  256. *
  257. ERROR at line 1:
  258. ORA-04013: number to CACHE must be less than one cycle


  259. SQL> alter  sequence seq1  nocache;

  260. Sequence altered.

  261. SQL> alter  sequence seq1  increment by 10   ;

  262. Sequence altered.

  263. SQL> alter  sequence seq1  start with 20;
  264. alter  sequence seq1  start with 20
  265.                       *
  266. ERROR at line 1:
  267. ORA-02283: cannot alter starting sequence number


  268. SQL> alter  sequence seq1  minvalue 20 ;

  269. Sequence altered.

  270. SQL> select  seq1.nextval from dual;

  271.    NEXTVAL
  272. ----------
  273.         52

  274. SQL> /

  275.    NEXTVAL
  276. ----------
  277.         62

  278. SQL> /

  279.    NEXTVAL
  280. ----------
  281.         72

  282. SQL> /

  283.    NEXTVAL
  284. ----------
  285.         82

  286. SQL> /

  287.    NEXTVAL
  288. ----------
  289.         92

  290. SQL> /

  291.    NEXTVAL
  292. ----------
  293.         20

  294. SQL> /

  295.    NEXTVAL
  296. ----------
  297.         30

  298. SQL> /

  299.    NEXTVAL
  300. ----------
  301.         40

  302. SQL> /

  303.    NEXTVAL
  304. ----------
  305.         50

  306. SQL> /

  307.    NEXTVAL
  308. ----------
  309.         60

  310. SQL> /

  311.    NEXTVAL
  312. ----------
  313.         70

  314. SQL> /

  315.    NEXTVAL
  316. ----------
  317.         80

  318. SQL> /

  319.    NEXTVAL
  320. ----------
  321.         90

  322. SQL> /

  323.    NEXTVAL
  324. ----------
  325.        100

  326. SQL> /

  327.    NEXTVAL
  328. ----------
  329.         20

  330. SQL> /

  331.    NEXTVAL
  332. ----------
  333.         30

  334. SQL> /

  335.    NEXTVAL
  336. ----------
  337.         40

  338. SQL> /

  339.    NEXTVAL
  340. ----------
  341.         50

  342. SQL> /

  343.    NEXTVAL
  344. ----------
  345.         60

  346. SQL> /

  347.    NEXTVAL
  348. ----------
  349.         70

  350. SQL> /

  351.    NEXTVAL
  352. ----------
  353.         80

  354. SQL> alter  sequence seq1  cache 10;
  355. alter  sequence seq1  cache 10
  356. *
  357. ERROR at line 1:
  358. ORA-04013: number to CACHE must be less than one cycle


  359. SQL> alter  sequence seq1  cache 7;

  360. Sequence altered.

  361. SQL>

复制代码

2014-10-25-E.txt
  1. CREATE VIEW   salvu50
  2. AS SELECT  employee_id ID_NUMBER, last_name NAME,
  3.             salary*12 ANN_SALARY
  4.     FROM    employees
  5.     WHERE   department_id = 50;

  6. select  * from   salvu50;

  7. update  salvu50  set ANN_SALARY=31201 where   ID_NUMBER=198;

  8. update  salvu50  set   ID_NUMBER=999 where   ID_NUMBER=198;


  9. select  * from employees order by 1;



  10. select  * from user_sequences;

  11. grant create public synonym to hr;
复制代码

2014-10-25-F.txt
  1. [root@station90 ~]# su - oracle
  2. [oracle@station90 ~]$ sqlplus /nolog

  3. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 15:19:25 2014

  4. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  5. SQL> conn hr/oracle_4U
  6. Connected.
  7. SQL> create table t05310_a ( a  number ) ;

  8. Table created.

  9. SQL> insert into t05310_a values (1) ;

  10. 1 row created.

  11. SQL> !ps
  12.   PID TTY          TIME CMD
  13. 16217 pts/2    00:00:00 sqlplus
  14. 16328 pts/2    00:00:00 ps

  15. SQL> commit;

  16. Commit complete.

  17. SQL> flashback table t05310_a to scn 2132750;
  18. flashback table t05310_a to scn 2132750
  19.                 *
  20. ERROR at line 1:
  21. ORA-08189: cannot flashback the table because row movement is not enabled


  22. SQL> alter table t05310_a enable row movement;

  23. Table altered.

  24. SQL> flashback table t05310_a to scn 2132750;

  25. Flashback complete.

  26. SQL> select  * from t05310_a;

  27. no rows selected

  28. SQL> flashback table t05310_a to scn 2142619;

  29. Flashback complete.

  30. SQL> select  * from t05310_a;

  31.          A
  32. ----------
  33.          1

  34. SQL> select  salary from employees where employee_id=100;

  35.     SALARY
  36. ----------
  37.      24000

  38. SQL> update employees  set salary=25000 where employee_id=100;

  39. 1 row updated.

  40. SQL> commit;

  41. Commit complete.

  42. SQL> update employees  set salary=26000 where employee_id=100;

  43. 1 row updated.

  44. SQL> commit;

  45. Commit complete.

  46. SQL> update employees  set salary=27000 where employee_id=100;

  47. 1 row updated.

  48. SQL> commit;

  49. Commit complete.

  50. SQL> update employees  set salary=28000 where employee_id=100;

  51. 1 row updated.

  52. SQL> commit;

  53. Commit complete.

  54. SQL> alter table employees enable row movement ;

  55. Table altered.

  56. SQL> flashback table employees to scn 2143354;

  57. Flashback complete.

  58. SQL> select salary from employees where employee_id=100;

  59.     SALARY
  60. ----------
  61.      26000

  62. SQL> select  versions_xid, versions_start_scn  , salary  
  63.   2   from employees
  64.   3   versions between minvalue and maxvalue
  65.   4   where employee_id=100;
  66. versions between minvalue and maxvalue
  67.                   *
  68. ERROR at line 3:
  69. ORA-00905: missing keyword


  70. SQL> ed
  71. Wrote file afiedt.buf

  72.   1  select  versions_xid, versions_start_scn  , salary
  73.   2   from employees
  74.   3   versions between minscn and maxscn
  75.   4*  where employee_id=100
  76. SQL> /
  77. versions between minscn and maxscn
  78.                   *
  79. ERROR at line 3:
  80. ORA-00905: missing keyword


  81. SQL> ed
  82. Wrote file afiedt.buf

  83.   1  select  versions_xid, versions_start_scn  , salary
  84.   2   from employees
  85.   3   versions between scn  minvalue  and maxvalue
  86.   4*  where employee_id=100
  87. SQL> /
  88. select        versions_xid, versions_start_scn  , salary
  89.                       *
  90. ERROR at line 1:
  91. ORA-00904: "VERSIONS_START_SCN": invalid identifier


  92. SQL> ed
  93. Wrote file afiedt.buf

  94.   1  select  versions_xid, versions_startscn  , salary
  95.   2   from employees
  96.   3   versions between scn  minvalue  and maxvalue
  97.   4*  where employee_id=100
  98. SQL> /

  99. VERSIONS_XID         VERSIONS_STARTSCN     SALARY
  100. ---------------- ----------------- ----------
  101. 0400060069050000           2144145        26000
  102. 0400060069050000           2144145        28000
  103. 09001A0002060000           2143370        28000
  104. 0A00160019050000           2143357        27000
  105. 0500140091060000           2143353        26000
  106. 0200200002060000           2143338        25000
  107.                                         24000

  108. 7 rows selected.

  109. SQL> flashback table employees to scn 2143338;

  110. Flashback complete.

  111. SQL> select  salary from employees where employee_id=100;

  112.     SALARY
  113. ----------
  114.      25000

  115. SQL> flashback table employees to scn 2143337;

  116. Flashback complete.

  117. SQL> select  salary from employees where employee_id=100;

  118.     SALARY
  119. ----------
  120.      24000

  121. SQL> flashback table employees to scn 2143352;

  122. Flashback complete.

  123. SQL> select  salary from employees where employee_id=100;

  124.     SALARY
  125. ----------
  126.      25000

  127. SQL> flashback table employees to scn 2143353;

  128. Flashback complete.

  129. SQL> select  salary from employees where employee_id=100;

  130.     SALARY
  131. ----------
  132.      26000

  133. SQL> select  versions_xid, versions_startscn  , salary
  134.   2  from employees
  135.   3   versions between scn  minvalue  and maxvalue
  136.   4   where employee_id=100;

  137. VERSIONS_XID         VERSIONS_STARTSCN     SALARY
  138. ---------------- ----------------- ----------
  139. 0A0009001A050000           2144731        26000
  140. 0A0009001A050000           2144731        25000
  141. 0800030074050000           2144699        25000
  142. 0800030074050000           2144699        24000
  143. 03000700E9050000           2144666        24000
  144. 03000700E9050000           2144666        25000
  145. 08000E0072050000           2144562        25000
  146. 08000E0072050000           2144562        26000
  147. 0400060069050000           2144145        26000
  148. 0400060069050000           2144145        28000
  149. 09001A0002060000           2143370        28000

  150. VERSIONS_XID         VERSIONS_STARTSCN     SALARY
  151. ---------------- ----------------- ----------
  152. 0A00160019050000           2143357        27000
  153. 0500140091060000           2143353        26000
  154. 0200200002060000           2143338        25000
  155.                                         24000

  156. 15 rows selected.

  157. SQL> create table t05310_b ( a  number ) ;

  158. Table created.

  159. SQL> insert into t05310_b values ( 1) ;

  160. 1 row created.

  161. SQL> commit;

  162. Commit complete.

  163. SQL> update t05310_b set a=2;

  164. 1 row updated.

  165. SQL> commit;

  166. Commit complete.

  167. SQL> update t05310_b set a=3;

  168. 1 row updated.

  169. SQL> commit;

  170. Commit complete.

  171. SQL> update t05310_b set a=4;

  172. 1 row updated.

  173. SQL> commit;

  174. Commit complete.

  175. SQL> update t05310_b set a=5;

  176. 1 row updated.

  177. SQL> alter table t05310_b  add ( b varchar2(20)) ;

  178. Table altered.

  179. SQL> update t05310_b set a=5;

  180. 1 row updated.

  181. SQL> rollback;

  182. Rollback complete.

  183. SQL> update t05310_b set a=6;

  184. 1 row updated.

  185. SQL> commit;

  186. Commit complete.

  187. SQL> alter table t05310_b  drop (b) ;

  188. Table altered.

  189. SQL> update t05310_b set a=7;

  190. 1 row updated.

  191. SQL> commit;

  192. Commit complete.

  193. SQL> update t05310_b set a=8;

  194. 1 row updated.

  195. SQL> commit;

  196. Commit complete.

  197. SQL> drop table t05310_b;

  198. Table dropped.

  199. SQL> create table t05310_c ( a  number ) ;

  200. Table created.

  201. SQL> insert into t05310_c values (1) ;

  202. 1 row created.

  203. SQL> commit;

  204. Commit complete.

  205. SQL> update t05310_c  set a=2;

  206. 1 row updated.

  207. SQL> commit;

  208. Commit complete.

  209. SQL> update t05310_c  set a=3;

  210. 1 row updated.

  211. SQL> commit;

  212. Commit complete.

  213. SQL> update t05310_c  set a=4;

  214. 1 row updated.

  215. SQL> commit;

  216. Commit complete.

  217. SQL> update t05310_c  set a=5;

  218. 1 row updated.

  219. SQL> commit;

  220. Commit complete.

  221. SQL> alter table t05310_c  enable row movement;

  222. Table altered.

  223. SQL> alter table t05310_c  skrink space;
  224. alter table t05310_c  skrink space
  225.                       *
  226. ERROR at line 1:
  227. ORA-01735: invalid ALTER TABLE option


  228. SQL> alter table t05310_c  shrink space;

  229. Table altered.

  230. SQL>















复制代码

2014-10-25-G.txt
  1. select   * from v$session where terminal='pts/2';

  2. select  * from v$transaction;

  3. select  * from flashback_transaction_query;

  4. select  d.SUPPLEMENTAL_LOG_DATA_MIN,
  5.             d.SUPPLEMENTAL_LOG_DATA_PK,
  6.             d.SUPPLEMENTAL_LOG_DATA_UI,
  7.             d.SUPPLEMENTAL_LOG_DATA_FK,
  8.             d.SUPPLEMENTAL_LOG_DATA_ALL
  9.              from v_$database  d ;
  10.             
  11.   alter database add supplemental log data;
  12. alter database add supplemental log data (primary key) columns;

  13. select  * from flashback_transaction_query  ftq
  14.   where ftq.xid='0600060015060000' ;
  15.   
  16.   select     t.row_movement   from dba_tables t where t.owner='HR' and t.table_name='T05310_A';
  17.   
  18.   alter table hr.t05310_a disable row movement;
  19.   
  20.   
  21.   select  * from flashback_transaction_query   ftq where ftq.undo_sql like '%EMPLOYEES%';
  22.   
  23.   select  d.SUPPLEMENTAL_LOG_DATA_MIN,
  24.             d.SUPPLEMENTAL_LOG_DATA_PK,
  25.             d.SUPPLEMENTAL_LOG_DATA_UI,
  26.             d.SUPPLEMENTAL_LOG_DATA_FK,
  27.             d.SUPPLEMENTAL_LOG_DATA_ALL
  28.              from v_$database  d ;
  29.             
  30.   alter database drop supplemental log data;
  31. alter database drop supplemental log data (primary key) columns;


  32. select  versions_xid, versions_startscn  ,  versions_operation  ,   a
  33. from hr.t05310_b
  34.    versions between scn  minvalue  and maxvalue;

  35. select  versions_xid, versions_startscn  ,  versions_operation  ,   a
  36. from hr.t05310_c
  37.    versions between scn  minvalue  and maxvalue;




  38.   
复制代码

2014-10-25-H.txt
  1. select  versions_xid, versions_startscn  ,  versions_operation  ,   a
  2. from hr.t05310_d
  3.    versions between scn  minvalue  and maxvalue;
  4.    
  5.    select  * from dba_recyclebin;
  6.    
  7.    purge dba_recyclebin;
  8.    
  9.    select * from dba_indexes i where i.owner='HR' and i.table_name='T05311_B';
  10.    
  11.    select  * from dba_constraints c where c.owner='HR' and c.table_name='T05311_B';
  12.    
  13.    alter index hr."BIN$Bjw8DVeVZy/gU1oAqMBjeA==$0"  rename to pk_t05311_b;
  14.    
  15.    
  16.    create tablespace tbs05311_a  datafile size 256K autoextend on ;
  17.    
  18.       select  * from dba_recyclebin;
  19.       
  20.       select   df.tablespace_name  , df.file_name, df.bytes/1024/1024    from dba_data_files  df where df.tablespace_name='TBS05311_A';
复制代码

2014-10-25-I.txt
  1. ORA-00905: missing keyword


  2. SQL> ed
  3. Wrote file afiedt.buf

  4.   1  select  versions_xid, versions_start_scn  , salary
  5.   2   from employees
  6.   3   versions between minscn and maxscn
  7.   4*  where employee_id=100
  8. SQL> /
  9. versions between minscn and maxscn
  10.                   *
  11. ERROR at line 3:
  12. ORA-00905: missing keyword


  13. SQL> ed
  14. Wrote file afiedt.buf

  15.   1  select  versions_xid, versions_start_scn  , salary
  16.   2   from employees
  17.   3   versions between scn  minvalue  and maxvalue
  18.   4*  where employee_id=100
  19. SQL> /
  20. select        versions_xid, versions_start_scn  , salary
  21.                       *
  22. ERROR at line 1:
  23. ORA-00904: "VERSIONS_START_SCN": invalid identifier


  24. SQL> ed
  25. Wrote file afiedt.buf

  26.   1  select  versions_xid, versions_startscn  , salary
  27.   2   from employees
  28.   3   versions between scn  minvalue  and maxvalue
  29.   4*  where employee_id=100
  30. SQL> /

  31. VERSIONS_XID         VERSIONS_STARTSCN     SALARY
  32. ---------------- ----------------- ----------
  33. 0400060069050000           2144145        26000
  34. 0400060069050000           2144145        28000
  35. 09001A0002060000           2143370        28000
  36. 0A00160019050000           2143357        27000
  37. 0500140091060000           2143353        26000
  38. 0200200002060000           2143338        25000
  39.                                         24000

  40. 7 rows selected.

  41. SQL> flashback table employees to scn 2143338;

  42. Flashback complete.

  43. SQL> select  salary from employees where employee_id=100;

  44.     SALARY
  45. ----------
  46.      25000

  47. SQL> flashback table employees to scn 2143337;

  48. Flashback complete.

  49. SQL> select  salary from employees where employee_id=100;

  50.     SALARY
  51. ----------
  52.      24000

  53. SQL> flashback table employees to scn 2143352;

  54. Flashback complete.

  55. SQL> select  salary from employees where employee_id=100;

  56.     SALARY
  57. ----------
  58.      25000

  59. SQL> flashback table employees to scn 2143353;

  60. Flashback complete.

  61. SQL> select  salary from employees where employee_id=100;

  62.     SALARY
  63. ----------
  64.      26000

  65. SQL> select  versions_xid, versions_startscn  , salary
  66.   2  from employees
  67.   3   versions between scn  minvalue  and maxvalue
  68.   4   where employee_id=100;

  69. VERSIONS_XID         VERSIONS_STARTSCN     SALARY
  70. ---------------- ----------------- ----------
  71. 0A0009001A050000           2144731        26000
  72. 0A0009001A050000           2144731        25000
  73. 0800030074050000           2144699        25000
  74. 0800030074050000           2144699        24000
  75. 03000700E9050000           2144666        24000
  76. 03000700E9050000           2144666        25000
  77. 08000E0072050000           2144562        25000
  78. 08000E0072050000           2144562        26000
  79. 0400060069050000           2144145        26000
  80. 0400060069050000           2144145        28000
  81. 09001A0002060000           2143370        28000

  82. VERSIONS_XID         VERSIONS_STARTSCN     SALARY
  83. ---------------- ----------------- ----------
  84. 0A00160019050000           2143357        27000
  85. 0500140091060000           2143353        26000
  86. 0200200002060000           2143338        25000
  87.                                         24000

  88. 15 rows selected.

  89. SQL> create table t05310_b ( a  number ) ;

  90. Table created.

  91. SQL> insert into t05310_b values ( 1) ;

  92. 1 row created.

  93. SQL> commit;

  94. Commit complete.

  95. SQL> update t05310_b set a=2;

  96. 1 row updated.

  97. SQL> commit;

  98. Commit complete.

  99. SQL> update t05310_b set a=3;

  100. 1 row updated.

  101. SQL> commit;

  102. Commit complete.

  103. SQL> update t05310_b set a=4;

  104. 1 row updated.

  105. SQL> commit;

  106. Commit complete.

  107. SQL> update t05310_b set a=5;

  108. 1 row updated.

  109. SQL> alter table t05310_b  add ( b varchar2(20)) ;

  110. Table altered.

  111. SQL> update t05310_b set a=5;

  112. 1 row updated.

  113. SQL> rollback;

  114. Rollback complete.

  115. SQL> update t05310_b set a=6;

  116. 1 row updated.

  117. SQL> commit;

  118. Commit complete.

  119. SQL> alter table t05310_b  drop (b) ;

  120. Table altered.

  121. SQL> update t05310_b set a=7;

  122. 1 row updated.

  123. SQL> commit;

  124. Commit complete.

  125. SQL> update t05310_b set a=8;

  126. 1 row updated.

  127. SQL> commit;

  128. Commit complete.

  129. SQL> drop table t05310_b;

  130. Table dropped.

  131. SQL> create table t05310_c ( a  number ) ;

  132. Table created.

  133. SQL> insert into t05310_c values (1) ;

  134. 1 row created.

  135. SQL> commit;

  136. Commit complete.

  137. SQL> update t05310_c  set a=2;

  138. 1 row updated.

  139. SQL> commit;

  140. Commit complete.

  141. SQL> update t05310_c  set a=3;

  142. 1 row updated.

  143. SQL> commit;

  144. Commit complete.

  145. SQL> update t05310_c  set a=4;

  146. 1 row updated.

  147. SQL> commit;

  148. Commit complete.

  149. SQL> update t05310_c  set a=5;

  150. 1 row updated.

  151. SQL> commit;

  152. Commit complete.

  153. SQL> alter table t05310_c  enable row movement;

  154. Table altered.

  155. SQL> alter table t05310_c  skrink space;
  156. alter table t05310_c  skrink space
  157.                       *
  158. ERROR at line 1:
  159. ORA-01735: invalid ALTER TABLE option


  160. SQL> alter table t05310_c  shrink space;

  161. Table altered.

  162. SQL> show user
  163. USER is "HR"
  164. SQL> create table t05310_d( a  number ) ;

  165. Table created.

  166. SQL> insert into t05310_d  values (1) ;

  167. 1 row created.

  168. SQL> commit;

  169. Commit complete.

  170. SQL> update t05310_d set a=2;

  171. 1 row updated.

  172. SQL> commit;

  173. Commit complete.

  174. SQL> update t05310_d set a=3;

  175. 1 row updated.

  176. SQL> commit;

  177. Commit complete.

  178. SQL> update t05310_d set a=4;

  179. 1 row updated.

  180. SQL> commit;

  181. Commit complete.

  182. SQL> update t05310_d set a=5;

  183. 1 row updated.

  184. SQL> commit;

  185. Commit complete.

  186. SQL> alter table t05310_d enable row movement ;

  187. Table altered.

  188. SQL> select  * from t05310_d;

  189.          A
  190. ----------
  191.          1

  192. SQL> conn / as sysdba
  193. Connected.
  194. SQL> show parameter recycle

  195. NAME                                     TYPE         VALUE
  196. ------------------------------------ ----------- ------------------------------
  197. buffer_pool_recycle                     string
  198. db_recycle_cache_size                     big integer 0
  199. recyclebin                             string         on
  200. SQL> conn hr/oracle_4U
  201. Connected.
  202. SQL> create table t05311_a ( a  number ) ;

  203. Table created.

  204. SQL> insert into t05311_a values (1) ;

  205. 1 row created.

  206. SQL> commit;

  207. Commit complete.

  208. SQL> drop table t05311_a;

  209. Table dropped.

  210. SQL> select  * from BIN$Bjw8DVeQZy/gU1oAqMBjeA==$0;
  211. select        * from BIN$Bjw8DVeQZy/gU1oAqMBjeA==$0
  212.                              *
  213. ERROR at line 1:
  214. ORA-00933: SQL command not properly ended


  215. SQL> select  * from "BIN$Bjw8DVeQZy/gU1oAqMBjeA==$0";

  216.          A
  217. ----------
  218.          1

  219. SQL> flashback table t05311_a to before drop;

  220. Flashback complete.

  221. SQL> select  * from t05311_a;

  222.          A
  223. ----------
  224.          1

  225. SQL> drop table t05311_a;

  226. Table dropped.

  227. SQL> create table t05311_a( b varchar2(20))  ;

  228. Table created.

  229. SQL> insert into t05311_a values ( 'A') ;

  230. 1 row created.

  231. SQL> commit;

  232. Commit complete.

  233. SQL> drop table t05311_a;

  234. Table dropped.

  235. SQL> flashback table t05311_a to before drop;

  236. Flashback complete.

  237. SQL> select  * from t05311_a;

  238. B
  239. --------------------
  240. A

  241. SQL> drop table t05311_a;

  242. Table dropped.

  243. SQL> flashback table "BIN$Bjw8DVeRZy/gU1oAqMBjeA==$0" to before drop;

  244. Flashback complete.

  245. SQL> select  * from t05311_a;

  246.          A
  247. ----------
  248.          1

  249. SQL> flashback table t05311_a to before drop;
  250. flashback table t05311_a to before drop
  251. *
  252. ERROR at line 1:
  253. ORA-38312: original name is used by an existing object


  254. SQL>
  255. SQL> flashback table "BIN$Bjw8DVeTZy/gU1oAqMBjeA==$0" to before drop;
  256. flashback table "BIN$Bjw8DVeTZy/gU1oAqMBjeA==$0" to before drop
  257. *
  258. ERROR at line 1:
  259. ORA-38312: original name is used by an existing object


  260. SQL> flashback table "BIN$Bjw8DVeTZy/gU1oAqMBjeA==$0" to before drop  rename to t05311_a2;

  261. Flashback complete.

  262. SQL> select * from t05311_a2;

  263. B
  264. --------------------
  265. A

  266. SQL> select * from t05311_a;

  267.          A
  268. ----------
  269.          1

  270. SQL> create table t05311_b ( a   number constraint pk_t05311_b  primary key ) ;

  271. Table created.

  272. SQL> insert into t05311_b (1) ;
  273. insert into t05311_b (1)
  274.                       *
  275. ERROR at line 1:
  276. ORA-00928: missing SELECT keyword


  277. SQL> insert into t05311_b  values (1) ;

  278. 1 row created.

  279. SQL> commit;

  280. Commit complete.

  281. SQL> drop table t05311_b;

  282. Table dropped.

  283. SQL> flashback table t05311_b  to before drop;

  284. Flashback complete.

  285. SQL> show user
  286. USER is "HR"
  287. SQL> create table t05311_c ( a  number )  tablespace tbs05311_a;

  288. Table created.

  289. SQL> insert into t05311_c values(1);

  290. 1 row created.

  291. SQL> commit;

  292. Commit complete.

  293. SQL> drop table t05311_c;

  294. Table dropped.

  295. SQL> conn / as sysdba
  296. Connected.
  297. SQL> create table hr.t05311_d tablespace tbs05311_a  as select  * from dba_source ;

  298. Table created.

  299. SQL> conn hr/oracle_$U
  300. ERROR:
  301. ORA-01017: invalid username/password; logon denied


  302. Warning: You are no longer connected to ORACLE.
  303. SQL> conn hr/oracle_4U
  304. Connected.
  305. SQL> flashback table  t05311_c  to before drop;
  306. flashback table  t05311_c  to before drop
  307. *
  308. ERROR at line 1:
  309. ORA-38305: object not in RECYCLE BIN


  310. SQL>

复制代码

2014-10-25-J.txt
  1. [root@station90 ~]# su - oracle
  2. [oracle@station90 ~]$ sqlplus /nolog

  3. SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 25 17:25:17 2014

  4. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  5. SQL> conn hr/oracle_4U
  6. Connected.
  7. SQL> create table t05311_i( a  number );

  8. Table created.

  9. SQL> insert into t05311_i values(1) ;

  10. 1 row created.

  11. SQL> commit;

  12. Commit complete.

  13. SQL> drop table t05311_i;

  14. Table dropped.

  15. SQL> flashback table t05311_i to before drop;
  16. flashback table t05311_i to before drop
  17. *
  18. ERROR at line 1:
  19. ORA-38305: object not in RECYCLE BIN


  20. SQL> drop table t05311_j;

  21. Table dropped.

  22. SQL> drop table t05311_k;

  23. Table dropped.

  24. SQL> flashback table t05311_j to before drop;

  25. Flashback complete.

  26. SQL> flashback t05311_k to before drop;
  27. flashback t05311_k to before drop
  28.           *
  29. ERROR at line 1:
  30. ORA-00905: missing keyword


  31. SQL> flashback  tables t05311_k to before drop;
  32. flashback  tables t05311_k to before drop
  33.            *
  34. ERROR at line 1:
  35. ORA-00905: missing keyword


  36. SQL> flashback  table t05311_k to before drop;

  37. Flashback complete.

  38. SQL> create table t05311_l( a  number ) ;

  39. Table created.

  40. SQL> insert into t05311_l values (1) ;

  41. 1 row created.

  42. SQL> commit;

  43. Commit complete.

  44. SQL> create materialized view log on t05311_l with sequence,rowid including new values;

  45. Materialized view log created.

  46. SQL> drop table t05311_l;

  47. Table dropped.

  48. SQL> flashback table t05311_l  to before drop;

  49. Flashback complete.

  50. SQL>

























复制代码

2014-10-25-K.txt
  1. select  * from user_recyclebin;
  2. purge tablespace  users  user  sh ;

  3. purge tablespace  users;

  4. select  * from dba_audit_policies;


  5. begin
  6.    dbms_fga.add_policy(object_schema => 'HR',
  7.    object_name => 'T05311_I',
  8.    policy_name => 'P1',audit_condition => 'a>5',audit_column => 'A',
  9.    statement_types => 'SELECT,INSERT');
  10. end;




  11. create table t05311_j( a   number constraint pk_t05311_j primary key ,   b varchar2(20)  ) ;

  12. create table t05311_k( a  number   ,   c date) ;

  13. create bitmap   index i05311_k  on  t05311_k(j.b)
  14. from t05311_j j ,  t05311_k k
  15. where j.a=k.a;

  16. select   /*+ index(k, i05311_k) */  j.a,b,c from t05311_j j ,  t05311_k k
  17. where j.a=k.a;

  18. select * from user_indexes where table_name='T05311_K';


  19. select * from user_mview_logs;

  20. select  * from MLOG$_T05311_L;


复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-26 23:50 , Processed in 0.041801 second(s), 24 queries .

快速回复 返回顶部 返回列表