SQL*PLUS -L选项巧用
SQL*PLUS -L选项巧用
从dba_extents返回结果为空 - Oracle10g
DBA经常需要用如下SQL来查看某个数据块数据哪个SEGMENT,但是在10g里这句SQL返回结果通常是空的。select * from dba_extents where file_id=30 and block_id<=1000 and block_id+blocks>=1000;[@more@]SOLUTION:SQL> alter session set "_optimizer_push_pred_cost_based"=false;Session alteredSQL> select * from dba_extents where file_id=30 and block_id<=1000 and block_id+blocks>=1000;OWNER SEGMENT_NAME
ASM (6)
关于单节点Windows系统中ASM试验的完整Word版本,请参见 http://zhyuh.itpub.net/resource/334/20793[@more@]
ASM (5)
=============================用DB Control管理ASM Instance=============================[@more@]ASM Instance建起来后,DB Control并不会自动管理该实例。可以用下面步骤将ASM Instance加到DB Control中。C:$oracle$product$10.2.0$db_1$database>set oracle_sid=orcl C:$oracle$product$10.2.0$db_1$database>emctl config agent addtarget c:$addasm.txtOracle Enterprise Manager 10g Database Control Release 10.2.0.1.0Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved. 其中addasm.txt文件内容
ASM (4)
===================在线删除一块磁盘===================[@more@]SQL> alter diskgroup dgroup1 2 drop disk dgroup1_0005; 磁盘组已变更。 随后察看各磁盘的空余空间,可以看到dgroup1_0005的空余空间逐渐变大,直至1000M(即整个磁盘C:ASMDISKSDISK6的大小),再将disk6状态mount变成closed;而其余几个磁盘的在差不多等量地变小。 SQL> select name,total_mb,free_mb from v$asm_disk; NAME TOTAL_MB FREE_M
ASM (3)
=============================数据库关闭状态下增加一块磁盘=============================[@more@]C:asmdisks>asmtool -create c:asmdisksdisk6 1000 --asm instance中SQL> startupASM 实例已启动 Total System Global Area 79691776 bytesFixed Size 1247396 bytesVariable Size 53278556 bytesASM Cache &nb
ASM (2)
========================二、将数据库转移到ASM上========================[@more@]我们用RMAN实现这一功能。在转移数据库以前,先设若干跟文件存储位置相关的参数。 C:¥oracle¥product¥10.2.0¥db_1¥database>set oracle_sid=orcl C:¥oracle¥product¥10.2.0¥db_1¥database>sqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 12月 28 10:38:52 2006 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> connect/ as sysdba已连接。SQL> show parameter db_create_file_des
单节点Windows上的ASM(1)
ASM (Automatic Storage Management) 是Oracle 10g的一个重要新特性,在实现数据库I/O自动负载平衡,数据文件镜像等方面起着重要的作用。即使是单节点的数据库,Oracle也推荐使用ASM。但一般文档上提到ASM时,都需要有磁盘组或者多块磁盘才能实现,这使得很多人无法建立学习和实践的环境。下面的实验将带领你在windows xp的操作系统中建立ASM环境,并将已有的数据库转移到ASM中,同时该实验1. 不需要磁盘组或者多块磁盘2. 不需要在Windows xp中安装虚拟机,Linux等复杂的步骤[@more@]=====================一、建立ASM Instance==========
Oracle 10g中DB control的host login失败问题
Windows XP上的Oracle10g,在DB control中,有些操作会要求用户进行Host Login(比如start listener, instance startup)。但是用户输入正确的user ID/password后,系统仍然提示错误E"RROR: Wrong password for user",并且登入失败。[@more@]解决办法:1. Control Panel, Administrative Tools.2. Click on Local Security Policy.3. Local Policies, User Rights Assignment.4. Double click, 'Log on as a batch job'.5. Add your local user that you are supplying for the Host Credentials
参数compatible的不可逆性
Oracle10g中,设置compatible参数时,其值不能比上一个值小,以保证Oracle10g不向下兼容,只能向上兼容。[@more@]详细解释如下:For example, let's say you set the COMPATIBLE parameter to 10.0.0 on the Initialization Parameters page in Enterprise Manager (EM), and start the database. If you then shut down the database and restart with the COMPATIBLE parameter set to 9.2.0, an error displays during startup informing you that the compatible setting cannot be reversed. A problem arises if you set the COMPAT
Oracle10g New Feature -- 14. OEM ( Oracle Enterprise Manager)
OEM的操作都比较直观,oracle10g里采用ie作为管理界面,比8i/9i的java界面显得更加简洁方便,注意的是要记得进入管理界面的URL,或者知道URL存在哪个文件中 [@more@] Enterprise ManagerThe port number for DB Console is found in $ORACLE_HOME/install/portlist.iniC:oracleproduct10.1.0db_1install>type portlist.iniUltra Search HTTP port number =5620Enterprise Manager Agent Port =iSQL*Plus HTTP port number =5560Enterprise Manager Console HTTP Port (orcl) = 5500Enterprise Manager Agent Port (o
Oracle10g New Feature -- 13. Automatic Shared Memory Management
Automatic Shared Memory Management 是个不错的功能。Oracle9i以前修改内存参数,都需要重新启动instance,9i时允许再线修改db_cache_size,shared_pool,log_buffer等参数,10g里能自动再线调整data buffer, shared pool, java pool 和large pool。不知道下一个版本里还有什么更进一步的改进? 总之Oracle内存管理是越来越方便了[@more@] Automatic Shared Memory ManagementAutomatic Shared Memory Management helps you to allocate memory where it’s needed most automatically. Users need not allocate memory between buff
Oracle10g New Feature --12. ASSM ( Automatic Segment Space Management )
关于ASSM,最主要的内容是dbms_space包的几个procedures。利用package dbms_space,我们可以确定segment中各个block的空间使用情况,预测segment能否shrink到期望的大小,预测要建索引的大小,存储参数改变时segment size的变化等。Oracle10g的ASSM另外一个新特性是可以在线回收segment的空闲block[@more@]ASSM ( Automatic Segment Space Management )We use table ZHYUH.EMP as the test object.1. find out exactly how much space is wasted in that segment that can be reclaimedSQL>set serveroutput o
Oracle10g New Feature -- 11. Wait Interface
本章内容同上一章一样,都是针对数据库性能。本章更注重对等待事件的分析。视图v$session_wait, v$session, v$session_wait_class, v$system_wait_class, v$session_wait_history帮助用户取得关于等待事件的各种详细信息[@more@]Wait Interface1. Enhancement in V$SESSION_WAIT Added 3 columns:WAIT_CLASS_ID WAIT_CLASS#WAIT_CLASS: the type of the wait that must be either addressed as a valid wait event or dismissed as an idle oneWAIT_TIME : -2 In Oracle10g,-2 mea
Oracle10g New Feature -- 10. AWR (Automatic Workload Repository)
Oracle10g的AWR替代了Oracle9i的statspack,能自动收集数据库性能信息,并可调整每次收集时间间隔和信息保存时长,或者手动收集信息。Time model和v$session / v$session_wait帮助用户确定各会话在各资源上所耗时间和在等待各资源上所耗的时间[@more@]1. Automatic Workload RepositoryIn Oracle10g, AWR(Automatic Workload Repository) replaces STATSPACK, and can collect snapshots automatically every hour by a new background process called MMON and its slave processes. To Run AWRSQL> @C:oracle
Oracle10g New Feature -- 9. ASM (Automatic Storage Management)
Oracle10g里,用户能在数据库级别直接管理磁盘。目前没有环境测试,就摘抄kamus的一份step by step文章,留着供下次察看。[@more@]Automatic Storage Management (ASM)1. Advantages of ASM· Disk Addition -- No downtime is required, file extents are redistributed automatically· Stripe Width -- Striping can be fine grained as in Redo Log Files and coarse for datafiles· &n
Oracle10g New Feature -- 8. Tablespace Management
在表空间管理方面,oracle10g最主要新特性是可以修改表空间名。这是一些初学者以前经常问到的一个问题,10g里面终于给解决掉了。关于表空间还有一个经常被问到的问题是如何删除表空间里的某个数据文件。这个问题到目前为止还只能说不能直接删。不知道到下一个版本里会如何,允许?还是永远都不能直接删除? 此外的两个新特性是:1. 修改数据库默认表空间2. 增加了sysaux表空间,主要存放logminer,workload repository等信息[@more@] Tablespace Management1. Alter the default tablespaceAll users, c
Oracle10g New Feature -- 7. Rollback Monitoring
在oracle10g中,如果某个回滚进程所用时间超过6秒,就能在v$session_longops中被捕捉到。这个看似微不足道的功能其实还挺有用的呢,至少对我来说是这样。以前做上海移动的项目时,一张表动仄上千万,开发和测试人员经常在一句SQL执行了半个小时或者更久后发现错误又急忙停止,等着回滚结束后再次执行。可惜回滚结束这个时间太难估计了,当DBA的就经常被他们追着问。有了上面这个功能后至少可以给他们一个大概的估计时间了,并且是有根据的哦。要是估计错了那也是oracle自己估计错了 :)至于另外一个parallel instance recovery功能,目前
Oracle10g New Feature -- 6. Oracle Data Pump
Oracle10g提供了expdp/impdp工具,其速度远快于以前的exp/imp。并且用户能进入交互界面,也能从数据库视图,alert_SID.log文件察看任务状态。由于expdp/impdp的dump文件只能在服务器端,故前提需要建一个directory。[@more@]1. Oracle Data PumpEnter Oracle Data Pump, the newer and faster sibling of the export/import toolkit in Oracle Database 10g, designed to speed up the process many times over1. PrepareData Pump uses file manipulation on the server side to create and r
Oracle10g New Feature -- 5.Temporary Tablespace Group
Oracle10g引入了临时表空间组的概念,和单个的临时表空间相比,引入组以后允许数据库指定多个默认的临时表空间,同时相同用户的不同会话可以使用不同的临时表空间,并且单个SQL运行时可以利用多个临时表空间进行排序(自动调用多个临时表空间吗?还无从得知)。目前感觉这个新特性作用并不是很大,主要是以前temp表空间出的问题不多。不知道真正用起来时如何。 创建组、增删表空间,指定组都是相对简单的操作[@more@]Temporary Tablespace Group · Create temporary tablespa