十一回了趟老家绍兴,看惯了都市的高楼大厦,看看老家的水乡景色,别有一番滋味。 当天去拍照的时候,刚好遇到一对新人在坐船举行婚礼,呵呵,平常车队接送的迎亲队伍看的多了,好久没见到坐船的迎亲队伍,作为水乡的儿女,这样的迎亲方式很有味道…… 祝福他们……
创建视图时引用表的权限问题
在做imp的时候,发现log中有以下报错:
1 2 3 4 5 6 7 8 |
…… IMP-00041: Warning: object created with compilation warnings "CREATE FORCE VIEW "MYUESR"."V_VIEW01" ("ICPCOD" "E") AS " "select user02.IcpCode" "from user01.icp icp,user01.custcontact custcontact" "where user02.id = custcontact.id(+)" …… |
通过直接在数据库查询,发现报错没有权限,但是select却是能够操作:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
SQL> select * from V_VIEW01 where rownum<10; select * from V_VIEW01 where rownum<10 * ERROR at line 1: ORA-04063: view "MYUESR.V_VIEW01" has errors SQL> show error view V_VIEW01 Errors for VIEW V_VIEW01: LINE/COL ERROR -------- ----------------------------------------------------------------- 0/0 ORA-01031: insufficient privileges SQL> SQL> select count(*) from user01.icp; COUNT(*) ---------- 976 SQL> select count(*) from user01.custcontact; COUNT(*) ---------- 1310 |
奇怪的是,MYUESR已经有dba权限,难道还不能建 […]
BUG:truncate分区后,segment大小没降低
今天遇到了一个的问题,一个分区表,当我truncate完一个分区,通过查看dba_segments.bytes竟然没有空间被释放:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production PL/SQL Release 9.2.0.6.0 - Production CORE 9.2.0.6.0 Production TNS for HPUX: Version 9.2.0.6.0 - Production NLSRTL Version 9.2.0.6.0 - Production SQL> CREATE TABLE xxx 2 (aa varchar2(20), 3 bb number ) tablespace tt 4 PARTITION BY RANGE (bb) 5 (PARTITION xxx_p1 6 VALUES LESS THAN (10000), 7 PARTITION xxx_p2 8 VALUES LESS THAN (40000), 9 PARTITION xxx_p3 10 VALUES LESS THAN (80000), 11 PARTITION xxx_p4 12 VALUES LESS THAN (100000), 13 PARTITION xxx_max 14 values less than (maxvalue) 15 ); Table created. SQL> select TABLESPACE_NAME from user_tab_partitions where table_name='XXX'; TABLESPACE_NAME ------------------------------ TT TT TT TT TT SQL> select INITIAL_EXTENT,EXTENTS,BYTES from user_segments where segment_name='XXX'; INITIAL_EXTENT EXTENTS BYTES -------------- ---------- ---------- 65536 1 65536 65536 1 65536 65536 1 65536 65536 1 65536 65536 1 65536 SQL> insert into xxx select 'aa',rownum from dba_objects; 97390 rows created. SQL> insert into xxx select * from xxx; 97390 rows created. SQL> insert into xxx select aa,rownum from xxx; 194780 rows created. SQL> commit; Commit complete. SQL> select INITIAL_EXTENT,EXTENTS,BYTES from user_segments where segment_name='XXX'; INITIAL_EXTENT EXTENTS BYTES -------------- ---------- ---------- 65536 7 458752 65536 17 2097152 65536 17 2097152 65536 13 851968 65536 17 2097152 SQL> alter table xxx truncate partition xxx_p1; Table truncated. SQL> select INITIAL_EXTENT,EXTENTS,BYTES from user_segments where segment_name='XXX'; INITIAL_EXTENT EXTENTS BYTES -------------- ---------- ---------- 65536 7 458752 ######truncate该分区,空间没释放 65536 17 2097152 65536 17 2097152 65536 13 851968 65536 17 2097152 SQL> alter table xxx truncate partition xxx_p2; Table truncated. SQL> select INITIAL_EXTENT,EXTENTS,BYTES from user_segments where segment_name='XXX'; INITIAL_EXTENT EXTENTS BYTES -------------- ---------- ---------- 65536 7 458752 65536 17 2097152 ######truncate该分区,空间没释放 65536 17 2097152 65536 13 851968 65536 17 2097152 |
但是在我机器上的数据库中进行测试,却是有正常的结果: [crayon-6844c47f9832e243 […]
谈谈容灾
今天来谈谈关于容灾的一些事情,其实网上很多关于容灾的方案、白皮书等等,各个厂家也有自己主推的容灾工具。在这里,我结合自己的工作经验,简单的谈谈我理解的数据库容灾。 容灾,要考虑投资额度,能承受多少最大的支出;要考虑能接受的损失范围,保证我最小业务运行有哪些条件;要考虑容灾的距离,是本地容灾还是异地容 […]
世说新语:什么dba最牛?
今天在qq群里面有人聊起来,做什么dba最牛?开发dba好乎 or 维护dba好乎?其实我个人认为只要技术好,都会做的很牛,都能为自己某一份比较好的收入,并且有一个比较广阔的职业前景。 不过,话又说回来了(发挥一下偶的恶搞性格),无论是开发dba还是维护dba,做supporter还是比较累的。 个 […]
一些X$表的小结
今天在eygle的网站上看到了一篇关于死事务的恢复进度查询的文章,里面介绍x$ktuxe表的使用。因此想对X$表进行一个整理,以便在今后使用的时候能方便的查询。如果大家有其他使用X$表的经验,也欢迎补充。 在oracle 9i R2的版本,有394个X$表: [crayon-6844c47f98f8 […]
一些常用的unix命令
1.PS1提示符:
1 2 |
unix:export PS1="[$LOGNAME@`hostname` $PWD$]" linux:export PS1='[\u@\h \W]\$' |
2.tar多个文件到一个tar包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
D:\oracle>ls -l total 0 drwxrwxrwx 1 Administrator None 0 Jun 16 19:56 admin drwxrwxrwx 1 Administrator None 0 May 28 23:27 arch drwxrwxrwx 1 Administrator None 0 Feb 19 22:02 ctl_file drwxrwxrwx 1 Administrator None 0 Sep 17 2006 ora92 drwxrwxrwx 1 Administrator None 0 Jun 21 10:43 ora_test_1 drwxrwxrwx 1 Administrator None 0 Jun 21 10:43 ora_test_2 drwxrwxrwx 1 Administrator None 0 Jun 21 10:43 ora_test_3 -rwxrwxrwa 1 Administrator None 0 Jun 21 10:42 ora_testfile.txt drwxrwxrwx 1 Administrator None 0 Jun 9 18:02 oradata 假如需要这些做tar包: ora_test_1 ora_test_2 ora_test_3 ora_testfile.txt D:\oracle>tar cf 111.tar ora_test_1 ora_test_2 ora_test_3 ora_testfile.txt D:\oracle>ls 111.tar arch ora92 ora_test_2 ora_testfile.txt admin ctl_file ora_test_1 ora_test_3 oradata |
3.查找ftpTmp下是否存在文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
report@my_testdb:/wapfile/Datafile$ ll total 608 drwxr-xr-x 7 report users 8192 Mar 15 05:22 aaa drwxr-xr-x 2 report users 16384 Jul 20 00:29 bbb drwxr-xr-x 18 report users 8192 Mar 30 18:18 ccc drwxr-xr-x 7 report users 8192 Mar 15 05:22 ddd drwxr-xr-x 7 report users 8192 Mar 15 05:22 eee drwxr-xr-x 8 report users 8192 Mar 15 05:22 fff drwxr-xr-x 8 report users 8192 Mar 15 05:22 ggg drwxr-xr-x 17 report users 8192 Jun 22 21:50 hhh drwxr-xr-x 16 report users 8192 Jun 22 21:49 iii 需要查找下面所有的路径下的ftpTmp路径下是否存在文件,可以用以下脚本: for loop in `ls ` do echo ${loop} >> temp.txt ll ${loop}/ftpTmp >> temp.txt done |
4.批量删除文件 […]
“酷”大于“好”
今天可能是苹果迷们心情上窜下跳的一天,首先,前段时间非常“酷”的iphone从599美元的价格今天突然跌到399美元,让前段时间入手iphone的粉丝捶胸顿足不已;另一方面,乔布斯也推出了新一代的ipod:ipod touch(见下图) 这一新产品的消息,又让苹果的粉丝们欢呼雀跃了!(iPod to […]
10g对sqlplus一处改进
今天在10g上用sqlpus登录后切换用户,发现sqlplus的提示能自动的改变,比起9i来,也算是个不错的进步了,因为在9i只能显示初次登录的信息,但是在10g却能实时的显示当前用户的信息了:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#### 9i,在conn 从sys用户切换到misc用户,提示信息没有改变,仍然是sys #### D:\oracle\ora92\bin>D:/oracle/ora92/bin/sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.1.0 - Production on 星期四 9月 6 23:42:57 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. 连接到: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production sys@ORALOCAL(192.168.0.22)> conn misc/misc 已连接。 sys@ORALOCAL(192.168.0.22)> --已经切换到misc用户了,但是提示还是sys用户 sys@ORALOCAL(192.168.0.22)> exit #### 10g,在conn 从sys用户切换到misc用户,提示信息会改变成当前的用户 #### D:\oracle\ora92\bin>D:\oracle10g\product\10.2.0\db_1\BIN\sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 9月 6 23:43:48 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. 连接到: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production sys@ORALOCAL(192.168.0.22)> conn misc/misc 已连接。 misc@ORALOCAL(192.168.0.22)> --已经切换到misc用户了,提示变成misc用户 |
因为hosts文件无法实现侦听动态注册
今天一个同事来求助sqlplus+sid登录不上的问题,测试登录,发现有ora-12514的报错:
1 2 3 4 5 6 7 8 9 |
oracle@my_testdb01:/oracle > sqlplus myuser/mypasswd@mysid SQL*Plus: Release 9.2.0.4.0 - Production on Wed Sep 5 15:36:06 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. ERROR: ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect descriptor |
检查了sqlnet.ora文件,发现NAMES.DIRECTORY_PATH= (TNSNAMES),是使用tsnnames,继续检查 […]
配置dp备份报错fail to load MML
今天在配置dp时,dp中报错: 用手工测试也有类似的报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
RMAN> run{ 2> allocate channel t1 type 'sbt_tape' ; 3> allocate channel t2 type 'sbt_tape' ; 4> backup datafile 3 5> format 'test_bk_%u_%p_%s.RMN' 6> include current controlfile; 7> } RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of allocate command on t1 channel at 09/01/2007 04:25:21 ORA-19554: error allocating device, device type: SBT_TAPE, device name: ORA-27211: Failed to load Media Management Library Additional information: 2 RMAN> ################################ ###### 但是备份到disk却没有问题 ################################ RMAN> RMAN> RMAN> RMAN> run{ 2> allocate channel t1 type disk ; 3> allocate channel t2 type disk ; 4> backup datafile 2 5> format '/iarch/test_bk_%u_%p_%s.RMN' 6> include current controlfile; 7> } allocated channel: t1 channel t1: sid=58 devtype=DISK allocated channel: t2 channel t2: sid=70 devtype=DISK Starting backup at 01-SEP-07 channel t1: starting full datafile backupset channel t1: specifying datafile(s) in backupset including current controlfile in backupset channel t1: starting piece 1 at 01-SEP-07 channel t2: starting full datafile backupset channel t2: specifying datafile(s) in backupset input datafile fno=00002 name=/dev/vg_iora01/rdata_1g_001 channel t2: starting piece 1 at 01-SEP-07 channel t1: finished piece 1 at 01-SEP-07 piece handle=/iarch/test_bk_01iqqmc8_1_1.RMN comment=NONE channel t1: backup set complete, elapsed time: 00:00:04 channel t2: finished piece 1 at 01-SEP-07 piece handle=/iarch/test_bk_02iqqmca_1_2.RMN comment=NONE channel t2: backup set complete, elapsed time: 00:00:37 Finished backup at 01-SEP-07 released channel: t1 released channel: t2 RMAN> |
检查了lib库中的link也是已经建立了:
1 2 |
gd_idb02:[/oracle/app/oracle/product/9.2.0/lib$]ll libobk.sl lrwxrwxrwx 1 oracle dba 36 Sep 3 10:01 libobk.sl -> /opt/omni/lib/libob2oracle8ale_64bit.sl |
后来查了相关的文档,才发现那个link的微妙差别,原来在64位的 […]
DBA要有良好的工作作风
dba不仅仅要有扎实的基础,良好的心态,更要有个良好的工作作风。 1、无论什么时候,要保证业务不受影响。你可以做清理,可以做优化,可以做备份,但是前提是这些操作不能影响到业务操作,需要预估这些操作的时间,会否延时到业务高峰期。这不仅要求dba了解数据库,也要了解业务,一个月中哪几天是业务高峰期;一天 […]