首页
论坛
门户
空间
手机版
IXPUB
插件
收藏
设置
注册
登录
商店
搜索
培训
Wiki
Blog
归档
丛书
退出
ITPUB论坛
»
Oracle入门与认证
» sg6笔记七
‹‹ 上一主题
|
下一主题 ››
18
1/2
1
2
››
投票
交易
悬赏
活动
评价
|
打印
|
推荐
|
订阅
|
收藏
标题: sg6笔记七
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#1
使用道具
发表于 2008-7-3 14:32
sg6笔记七
在Oracle9i里,Oracle提供了一个内部事件,用以强制刷新Buffer Cache,其语法为:
alter session set events 'immediate trace name flush_cache level 1';
或者:
alter session set events = 'immediate trace name flush_cache';
类似的也可以使用alter system系统级设置:
alter system set events = 'immediate trace name flush_cache';
在Oracle10g中,Oracle提供一个新的特性,可以通过如下命令刷新Buffer Cache:
alter system flush buffer_cache;
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#2
使用道具
发表于 2008-7-3 14:47
SQL> drop tablespace undotbs1;
drop tablespace undotbs1
*
ERROR at line 1:
ORA-30013: undo tablespace 'UNDOTBS1' is currently in use
SQL> alter tablespace undotbs1 offline;
alter tablespace undotbs1 offline
*
ERROR at line 1:
ORA-30042: Cannot offline the undo tablespace
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#3
使用道具
发表于 2008-7-3 14:47
alter system set undo_tablespace=zxy
drop tablespace undotbs1 --非活动的undo表空间可以删除
SQL> select file_name,bytes/1024/1024 from dba_data_files where file_name like '%undo%';---undo表空间可以resize
FILE_NAME
--------------------------------------------------------------------------------
BYTES/1024/1024
---------------
/home/oracle/oracle10g/oradata/rac1/undotbs01.dbf
95
SQL> alter database datafile '/home/oracle/oracle10g/oradata/rac1/undotbs01.dbf' resize 100m;
Database altered.
SQL> select file_name,bytes/1024/1024 from dba_data_files where file_name like '%undo%';
FILE_NAME
--------------------------------------------------------------------------------
BYTES/1024/1024
---------------
/home/oracle/oracle10g/oradata/rac1/undotbs01.dbf
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#4
使用道具
发表于 2008-7-3 15:03
SQL> select usn,name from v$rollname;
USN NAME
---------- ------------------------------
0 SYSTEM
11 _SYSSMU11$
12 _SYSSMU12$
13 _SYSSMU13$
14 _SYSSMU14$
15 _SYSSMU15$
16 _SYSSMU16$
17 _SYSSMU17$
18 _SYSSMU18$
19 _SYSSMU19$
20 _SYSSMU20$
11 rows selected.
只看该作者
rockyan712
Rock
来自 Beijing
精华贴数 0
个人空间
0
技术积分 287 (6831)
社区积分 135 (2941)
注册日期 2005-6-15
论坛徽章:4
#5
使用道具
发表于 2008-7-3 15:10
什么时候才用到这些呢?
能不能说说什么时候用啊?
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#6
使用道具
发表于 2008-7-3 15:42
手工管理rollback
create rollback segment tablespace
create public rollback segment tablespace
alter rollback segment online;--才可以用
undo_tablespace
rollback_segment=('rollseg1','rollseg2') --specify it in init.ora,use for startup private rollback segment
transactions
transactions_per_rollback_segment ---use for public rollback segment
在资料上看到估算undo表空间的大小的脚本如下:
SELECT (UR * (UPS * DBS)) + (DBS * 24) AS "Bytes"
FROM (SELECT value AS UR
FROM v$parameter
WHERE name = 'undo_retention'),
(SELECT (SUM(undoblks)/SUM
(((end_time-begin_time)*86400))) AS UPS
FROM v$undostat),
(SELECT value AS DBS
FROM v$parameter
WHERE name = 'db_block_size');
[
本帖最后由 wisdomone1 于 2008-7-3 16:37 编辑
]
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#7
使用道具
发表于 2008-7-3 16:15
table type:regular table,partioned table,index-organized table,cluster
char ---length maximum 2000
SQL> create table test(a char(2001));
create table test(a char(2001))
*
ERROR at line 1:
ORA-00910: specified length too long for its datatype
SQL> create table test(a char(2000));
Table created.
SQL> create table test(a varchar2(4001));
create table test(a varchar2(4001))
*
ERROR at line 1:
ORA-00910: specified length too long for its datatype
SQL> create table test(a varchar2(4000));
Table created.
long|raw access data must 顺序存取,只有2gb,other 4gb and random access
extended rowid
data object number( relative file number block number row number ---18,64进制
restricted rowid
block number row number file number
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#8
使用道具
发表于 2008-7-6 15:58
temporary table ---not genarate redo log,
not accuire lock,also can create index,view,trigger and so on
create global temporary table zxy
on commit delete rows|on commit preserve rows
as
select * from scott.emp;
读写和只读表存储在不同表空间,对备份有作用,还有临时表和永久表不同
采用inital and next same extent size,not use pctincrease (in fact equal to 0)
SQL> conn scott/system;
Connected.
SQL> cl scr;
SQL> create global temporary table tmptb
2 on commit delete rows
3 as
4 select * from emp;
Table created.
SQL> select * from tmptb;
no rows selected
SQL> insert into tmptb select * from emp;
14 rows created.
SQL> select count(*) from tmptb;
COUNT(*)
----------
14
SQL> commit;
Commit complete.
SQL> select count(*) from tmptb;
COUNT(*)
----------
0
alter table authors allocate extent(1m datafile '');---起作用就是强制给表分配在表空间不同物理文件上,对表的性能DML有好处提升
SQL> create global temporary table tmptb
2 on commit preserve rows
3 as
4 select * from emp;
Table created.
SQL> select count(*) from tmptb;
COUNT(*)
----------
14
SQL> /
COUNT(*)
----------
14
SQL> commit;
Commit complete.
SQL> select count(*) from tmptb;
COUNT(*)
----------
14
SQL> delete from tmptb where rownum<3;
2 rows deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from tmptb;
COUNT(*)
----------
12
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@primary ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 4 02:29:16 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn scott/system;
Connected.
SQL> desc tmptb;
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> select count(*) from tmptb;
COUNT(*)
----------
0
alter table scott deallocate unused;---refer to hwm above
alter table emp move tablespace users;---indexes,constraints,privelage可以preserve,但无效,要重建或recompile,
用于性能平衡,负荷均匀
then
alter index rebuild|tablespace tbs;
alter table zxy drop column comments cascade constraints checkpoint 1000;
alter table zxy set unused column comments cascade constraints;
alter table zxy drop unused checkpoint 1000;
continue
alter table zxy drop columns continue checkpoint 1000;---加continue是为了防止下次重复删除动作,是为了大数据量表列的删除,从上次失败的中断点继续删除
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#9
使用道具
发表于 2008-7-6 18:01
index: independant physical structure
speed query,but overhead data update
b-tree:nonleaf|leaf
root
branch
leaf ---pointer to data(index entry:index entry header,index column length,index column value,rowid
bitmap index:use data warehousing
index creation:do not use pctused
5个block的倍数或miminum extent的整数倍
对大数据量create index nologging;
SQL> show parameter create_bitmap
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
create_bitmap_area_size integer 8388608
SQL> select 8388608/1024 from dual;
8388608/1024
------------
8192
create index idx table(col) reverse;--一般用于序列或前多位相同的
alter index idx rebuild online;--为了重建索引时保持系统并发性,也有一short time lock
reverse and b-tree index can not transform
alter index idx coalesce;
anylyze index idx validate structure;--更新索引统计信息,针对index_stats
在大批量加载数据量,先drop index,then create index
alter index idx no|monitoring usage;
SQL> select index_name,table_name,column_expression from dba_ind_expressions;
INDEX_NAME TABLE_NAME COLUMN_EXPRESSION
------------------------------ ------------------------------ ------------------
--------------------------------------------------------------
I_WRI$_OPTSTAT_TAB_OBJ#_ST WRI$_OPTSTAT_TAB_HISTORY SYS_EXTRACT_UTC("S
AVTIME")
I_WRI$_OPTSTAT_TAB_ST WRI$_OPTSTAT_TAB_HISTORY SYS_EXTRACT_UTC("S
AVTIME")
I_WRI$_OPTSTAT_IND_OBJ#_ST WRI$_OPTSTAT_IND_HISTORY SYS_EXTRACT_UTC("S
AVTIME")
I_WRI$_OPTSTAT_IND_ST WRI$_OPTSTAT_IND_HISTORY SYS_EXTRACT_UTC("S
只看该作者
wisdomone1
西北苍狼
希望会员
精华贴数 0
个人空间
0
技术积分 2454 (638)
社区积分 60 (4465)
注册日期 2007-3-15
论坛徽章:4
#10
使用道具
发表于 2008-7-6 18:15
alter table emp add constraint pk check() enable novalidate;--旧数据不起作用,新数据起作用.
disable novalidate;--旧的不起作用,新的数据不起作用
disable validate;--对旧起作用,新不起作用
alter table zxy modify constraint pk
enable novalidate;---对旧不起作用,对新的起作用,在工作可以多采用它
enable validate;--default,新旧都起作用
enable|disable --对运行过程中控制
no|validate ---对已存在的数据进行控制
只看该作者
18
1/2
1
2
››
投票
交易
悬赏
活动
相关内容
ITPUB论坛
≡ 数据库技术 ≡
> Oracle数据库管理
> Oracle开发
> Oracle Developer Suite
> Oracle入门与认证
> Oracle专题深入讨论
> Oracle新技术/11g
> Oracle电子文档
> Oracle Application Server套件
> IBM数据库产品
> MS SQL Server
> Sybase管理与开发
> MySQL及其它开源数据库
> 内存数据库
> 数据仓库与数据挖掘
> 移动及嵌入式数据库
≡ 企业信息化 ≡
> ERP产品与实践
> CRM产品与实践
> HR产品与实践
> 物流
> 供应链
> 供应链建模与仿真
> 物流设备与系统工程
> 企业管理咨询
> 管理协同与办公自动化
> IT服务管理
> 数据中心建设
> ERP二次开发
> Oracle ERP
> EBS相关文档
> PeopleSoft与JDE
> SAP R/3
> SAP Business One开发与快速实施
> SAP财务及CRM
> SAP后勤及HR
> mySAP ERP
> 系统开发及跨应用设置
> SAP相关文档
> 国外其它ERP产品
> 国内ERP产品
≡ 开发技术 ≡
> Java入门与认证版
> Java web开发及框架技术
> Java企业开发
> ASP.NET【已迁移到微软开发技术论坛】
> .Net企业开发与应用【已迁移到微软开发技术论坛】
> WEB程序开发
> WEB 2.0技术
> 动态语言
> 移动与游戏开发
≡ 系统设计与项目管理 ≡
> 系统分析与UML
> 系统分析与UML精华区
> 项目管理
> 项目过程
> 软件测试
> 算法讨论与研究
≡ IBM软件技术园地 ≡
> IBM数据库产品
> Lotus
> Tivoli
> Websphere
> Rational
> 与SOA相关的IBM产品与技术
> IBM软件技术精英协会
> 软件技术精英活动专版
≡ 操作系统与硬件 ≡
> AIX及IBM产品【已迁移到IXPUB】
> HP-UX及HP产品【已迁移到IXPUB】
> Solaris及SUN产品【已迁移到IXPUB】
> Linux及其应用 【已迁移到IXPUB】
> 其它UNIX系统【已迁移到IXPUB】
> windows系统及微软相关产品 【已迁移到IXPUB】
> 存储设备与容灾技术 【已迁移到IXPUB】
> 服务器 【已迁移到IXPUB】
≡ 行业纵向讨论区 ≡
> IT业界评论与展望
> 政府与教育事业
> 中国政府信息主管联盟
> 电信行业
> 金融行业
> 医卫行业
> 制造行业
> 电力行业
> 信息安全与审计
≡ 会员交流 ≡
> IT职业生涯
> 招聘求职商务信息
> 体育世界
> 体育博彩专版
> 旅游,驴友
> 汽车世界
> 外语角
> 数码摄影
> 你的故事我的歌
> 音乐推荐区
> 电子图书与IT文档资料
> 软件交流
> 软件交流精华区
≡ ITPUB产品与服务 ≡
> ITPUB地面活动专版
> BLOG天地
> WIKI世界
> 授权用户区
> 站务管理
≡ 微软开发技术 ≡
> 开发工具和语言
> .NET Framework 相关
> Visual Basic/VB.net
> Visual C#
> Visual C++/vc.net
> Visual Studio
> .NET软件架构与模式
> .NET开发辅助工具及框架
> Web开发
> ASP.NET与AJAX
> Web相关技术讨论(IIS等)
> Silverlight 技术
> 微软企业级产品技术
> SQL Server
> windows server
> SharePoint
> Exchange Server
> Biztalk
> 嵌入式及移动开发
> Windows Embedded 嵌入式技术
> Windows 移动设备
> Office开发
> Microsoft office system
> Office Business Application
> 微软产品用户交流区
> .Net电子书籍&&书籍介绍
> .Net人才交流
技术积分榜
社区积分榜
徽章
电子杂志
会员
团队
统计
邮箱
游乐场
帮助
TOP
CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号
联系我们
法律顾问
控制面板首页
编辑个人资料
积分交易
公众用户组
好友列表
升级个人空间
基本概况
论坛排行
主题排行
发帖排行
积分排行
在线时间
管理团队
管理统计