Menghe

统计

常用链接

积分与排名

My Link

阅读排行榜

评论排行榜

最新评论

re: 开最便宜的汽车 李爽 2008-08-21 15:22  
写的挺好,是你自己 的 总结吗??给我们这些已婚人士多一些自我思考,多敲一敲警钟!!希望我们都能做到!!
re: 高晔钧的留言 邸利平 2007-02-09 20:38  
鸟人,好久没见了
re: 开最便宜的汽车 孟和 2006-08-29 12:50  
这个贴子的回复一如这个贴子的内容:)
re: 开最便宜的汽车 不管后开 2006-08-29 10:23  
价钱不是问题,重要是质量的保证。
re: 快速配置weblogic8.X的应用目录 menghe 2006-06-17 09:56  
appweb应该是一个文件夹,需要帮忙的话,我的MSN:menghe_yun(a)hotmail.com
b.目录创建完成后,在控制台的首页,选择“Web Application Modules”->”Deploy a new Web Application Module... ”,在”Location”下选择你刚才创建的appweb(注意这个目录一定要有WEB-INF目录,并且在WEB-INF目录下一定要有 web.xml文件,否则不能够创建应用目录)。选择后,点击”target module”,返回,可以看到当前weblogic服务中依成功创建的应用目录了。然后再创建一个index.html文档放在appweb目录下,就完成了应用目录的创建。

出现错误:
当已经建立web.xml文件,选择appweb文件后点击“目标模块”后,屏幕提示是找不到相应文件,可以帮忙解决吗?
re: Introducing Java 5 孟和 2006-05-26 19:30  
这篇文章没有讲到for的语法变化,一个简单的例子:
public static int addMethod(String memo,Object ... args){
int res =0;
for(Object arg:args){
res += (Integer)arg;
}
System.out.printf("the memo is %1s, the sum is %2i",memo,res);
return res;
}
忘记mysql 密码的取回方法

如果 MySQL 正在运行,
首先杀之: killall -TERM mysqld(如果是windows,直接调出进程管理器,结束之)
以安全模式启动 MySQL :
/usr/bin/safe_mysqld --skip-grant-tables &
(windows 下 mysql安装所以盘/mysql/bin/safe_mysqld --skip-grant-tables )
就可以不需要密码就进入 MySQL 了。
然后就是
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
重新杀 MySQL ,用正常方法启动 MySQL 。
re: 性能测试 之 JMeter loadtester 2006-03-26 22:36  
很高兴认识你,我是Bonoy JMeter的版主,多多交流。JMeter中文论坛上有更多资源,更多朋友可以一起学习这个工具。http://www.bonoy.com/a/index.php?name=PNphpBB2&file=viewforum&f=39

http://www.bonoy.com/jmeter JMeter中文网站
re: 如何处理大数据量的查询 孟和 2005-11-03 15:27  
这个内容是我在Teched上了解到的,最近手头有一大堆其他工作,还没有具体进行测试,纪录到我的Blog中,以后时间充裕的时候,对这个内容作一个深入的学习。

一个有数百万的表,甚至更多纪录的表。假设这个表的结构为:(table table1)

int 自增 aa

nvarchar? bb

我们可以把这个表根据 aa 的字段拆分为数个表。然后把这数个表做成一个视图。View1

在拆分的这数个表中,每个表都使用 Check 对 aa的范围进行一下约束。这样如果我们 使用 select * form view1 where aa = 000000? 这样只会在其中一个拆分表中查寻,而不会在多个表中查寻。这样可以减少锁的问题,同时查询速度也快。

?
re: Interview English 南 2005-10-23 22:11  
真是雪中送炭 啊
re: ORACLE数据库启动关闭 孟和 2005-09-07 19:05  
1. 关于ORACLE优化器的说明

ORACLE的优化器共有3种:
a. RULE (基于规则)
b. COST (基于成本)
c. CHOOSE (选择性)

1.1.在缺省情况下,ORACLE采用CHOOSE优化器(INIT.ORA 参数 OPTIMIZER_MODE可查 ), 为了避免那些不必要的全表扫描(full table scan) ,
1.2.我们尽量避免使用CHOOSE优化器,而直接采用基于规则或者基于成本的优化器.
1.3.尽管基于成本的优化器常常是对性能最有效的,你必须经常运行analyze 命令,
以增加数据库中的对象统计信息(object statistics)的准确性.所以我们也尽量避免使用COST优化器;

2.基于RULE优化器的SQL语法

--SELECT /*+ RULE */
--FROM CHILDTABLE A,MAINTABLE B
--WHERE B.KEY = A.KEY
--AND B.KEY = :KEY;

3. 基于规则的优化器的SQL优化写法

3.1.选择最有效率的表名顺序(只在基于规则的优化器中有效)

规则1: ORACLE的解析器按照从右到左的顺序处理FROM子句中的表名,
因此FROM子句中写在最后的表(基础表 driving table)将被最先处理.
在FROM子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表.

规则2: 当ORACLE处理多个表时, 会运用排序及合并的方式连接它们.
首先,扫描第一个表(FROM子句中最后的那个表)并对记录进行派序,
然后扫描第二个表(FROM子句中最后第二个表),最后将所有从第二个表中检索出的记录与第一个表中合适记录进行合并.
当所有的连接条件都有索引对应, 在这种情况下, 基础表就是FROM 子句中列在最后的那个表.

规则3: WHERE子句中的连接顺序.
ORACLE采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他WHERE条件之前,
那些可以过滤掉最大数量记录的条件必须写在WHERE子句的末尾.

规则4: SELECT子句中避免使用 ' * '
当你想在SELECT子句中列出所有的COLUMN时,使用动态SQL列引用 '*' 是一个方便的方法.
不幸的是,这是一个非常低效的方法.
实际上,ORACLE在解析的过程中, 会将'*' 依次转换成所有的列名, 这个工作是通过查询数据字典完成的, 这意味着将耗费更多的时间.
re: 内存泄漏,走开! 孟和 2005-08-26 16:30  
启动脚本中各参数阐述:
http://www.5ivb.net/Info/128/Info38126/
re: 内存泄漏,走开! 孟和 2005-08-26 16:28  
http://e-docs.bea.com/wls/docs81/perform/JVMTuning.html#1127089
http://java.sun.com/docs/hotspot/gc/

4)Solaris 系统中调整TCP参数
5)调整系统中用户进程空间大小
6)调整运行weblogic的JVM的内存Heap size,在2G以下,越大越好。 参数: -Xms:xxxM -Xmx:xxxM
7)调整JVM的Young Generation的size大小. 参数:-XX:NewSize=xxxm -XX:MaxNewSize=xxxm
8)调整JVM得Permanent Generation的Size大小. 参数: -XX:MaxPermSize=xxxm.
9)在支持的平台,打开Weblogic 的Native IO可以提高性能。
10)调整weblogic的Thread Count为合适的值。
re: 性能测试 之 JMeter 孟和 2005-08-24 14:41  
FAQ: OutOfMemory in WebLogic

From time to time I see questions like this:

Q: "We are seeing OutOfMemory error in the WebLogic log, after that our app becomes inaccessible. The application is not under heavy load. In fact, we can see it even if the server is idle. WebLogic performance console shows that there is plenty of heap available. What's wrong?".

A: Given the symptoms above, the most likely cause of the problem is that the default size of the heap allocated by JVM for long living objects is often too small for a J2EE application is general and for one under WebLogic in particular. Weblogic uses caching a lot, so if you've got many EJBs, there will be plenty of long living object, and they may not fit into perm heap.

To fix this problem, you need to increase MaxPermSize JVM parameter. Go to WebLogic startup script and add -XMaxPermSize=64m or -XMaxPermSize=128m to JVM startup parameters. If you don't have an application memory leak, this change should take care about the problem.

Q: But how do I know if it's not an app memory leak?

A: The first symptom of the app memory leak is that in addition to OutOfMemory, you will see that the memory graph in WebLogic performance console hits the top, and forcing GC doesn't change anything. Fixing this problem is relatively easy. Get a good profiler tool, like OptimizeIt of JProfiler, and run a load test while memory profiling is enabled. Set up a filter to see only your classes and fined ones taking most of memory. It's likely that the same objects will have largest instance counts.

Tips for setting up a profiler.


First, set the JVM memory to as minimum as possible. If you expect WebLogic to run with 1Gb of JVM heap, set it to much lower values at which app can run. It can be 32M, 64M, depending on the app. Is sounds odd, but the reason is that the memory profiler catches JVM GC activities, and as there will be much more object in 1GB than in 64Mb, that GC under profiler will be dead slow, it can be hours, virtually. Set memory to as low as possible.

Second, turn off anything except the memory profiling. Memory profiling itself is slow, so you will want yo avoid any additional overhead in this case. Performance profiling is to be turned off in any case.
re: 性能测试 之 JMeter 孟和 2005-08-23 17:39  
在Windows系统中与WebLogic8集成使用Optimizeit工具

本文介绍如何在WebLogic8中集成使用Optimizeit工具(Profiler, Thread Debugger, Code Coverage)。您只需配置一次,就可完成Optimizeit所有工具与WebLogic的集成。以下用法只适用于Windows系统平台。

注意:本文中用代表Optimizeit的安装目录 (例如:\Optimizeit\OptimizeitSuite60),
代表WebLogic的安装目录 (例如D:\bea\weblogic81)。
配置WebLogic脚本
为了使WebLogic运行时启动Optimizeit,需要创建一个包含Optimizeit参数的启动WebLogic的脚本。
1、 将用于启动WebLogic服务器的脚本做一个备份。例如:
将D:\bea\user_projects\domains\collectdomain\ startWebLogic.cmd
备份为
D:\bea\user_projects\domains\collectdomain\ startWebLogic_OI.cmd

2、 用文本编辑器打开备份脚本。

3、 在备份脚本中找到如下的代码行:
"%JAVA_HOME%\bin\java" %JAVA_VM% %MEM_ARGS%
%JAVA_OPTIONS%
-Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username=%WLS_USER%
-Dweblogic.management.password=%WLS_PW%
-Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE%
-Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" weblogic.Server

4、 在这些启动WebLogic代码行之间插入如下代码:
set OPTIT_HOME=
set PATH=%OPTIT_HOME%\lib;%PATH%
set CLASSPATH=%OPTIT_HOME%\lib\optit.jar;%CLASSPATH%
set JAVA_OPTIONS=-Xrunoii:filter="%OPTIT_HOME%\filters\WebLogic.oif"
-Xbootclasspath/a:"%OPTIT_HOME%\lib\oibcp.jar" %JAVA_OPTIONS

5、 在set OPTIT_HOME=处填写,即optimizeit的安装路径。例如:
set OPTIT_HOME=D:\Optimizeit\OptimizeitEntSuite60

Starting your application server with Optimizeit
启动带有Optimizeit的应用服务器
注意: 如果之前您已经安装了Optimizeit的任何产品,需要先停止运行Audit System Selector,然后通过/lib/OISelector.exe文件来启动Optimizeit。
1. 在任务栏上鼠标右键单击Audit System Selector图标,从弹出的菜单中选择你想要运行的工具。

2、使用startWebLogic_OI.cmd脚本来启动WebLogic。

Attaching from Optimizeit
一旦嵌有Optimizeit Audit System的WebLogic服务器启动,你就可以打开Optimizeit其中的任意一种工具从java虚拟机上获取有用的信息。
1、 确保你的应用服务器正在运行,并且你想测量的应用程序已经部署并且正在运行。
2、 标双击任务栏Audit System Selector图标,打开Audit System Selector。

从窗口的标签上选择用来测试的工具 (Profiler, Code Coverage,或者Thread Debugger), 然后单击Start。
3、 Optimizeit自动弹出编辑设置窗口,单击OK。
4、 单击菜单Program|Attach打开Attach对话框。
5、 输入机器名和端口后,然后单击Attach.。
默认情况下主机名为localhost,Profiler使用1470端口,Thread Debugger使用1471端口,Code Coverage使用1472端口。当连接上应用程序后工具会自动打开监视窗口。
6、 在完成测试后,从菜单Program下单击Detach停止监视。
当应用服务器监视完成时,应该将Optimizeit从应用服务器上分离开。
无论是连接还是分离Optimizeit,都不会影响应用服务器
re: 性能测试 之 JMeter 孟和 2005-08-23 11:15  
内存不足分析方法:
http://www.bea.com.cn/support_pattern/Investigating_Out_of_Memory_Memory_Leak_Pattern.html
J2EE性能分析工具:
1、Optimizeit
2、JProbe Suite
re: 学习笔记 之 2004年11月 孟和 2005-08-09 17:29  
Oracle维护常用SQL语句

1、查看表空间的名称及大小
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;

2、查看表空间物理文件的名称及大小
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;

3、查看回滚段名称及大小
select segment_name, tablespace_name, r.status,
(initial_extent/1024) InitialExtent,(next_extent/1024) NextExtent,
max_extents, v.curext CurExtent
From dba_rollback_segs r, v$rollstat v
Where r.segment_id = v.usn(+)
order by segment_name ;

4、查看控制文件
select name from v$controlfile;

5、查看日志文件
select member from v$logfile;

6、查看表空间的使用情况
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;

SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;

7、查看数据库库对象
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;

8、查看数据库的版本 
Select version FROM Product_component_version
Where SUBSTR(PRODUCT,1,6)='Oracle';

9、查看数据库的创建日期和归档方式
Select Created, Log_Mode, Log_Mode From V$Database;

10、捕捉运行很久的SQL
column username format a12
column opname format a16
column progress format a8

select username,sid,opname,
round(sofar*100 / totalwork,0) || '%' as progress,
time_remaining,sql_text
from v$session_longops , v$sql
where time_remaining <> 0
and sql_address = address
and sql_hash_value = hash_value
/

11、查看数据表的参数信息
SELECT partition_name, high_value, high_value_length, tablespace_name,
pct_free, pct_used, ini_trans, max_trans, initial_extent,
next_extent, min_extent, max_extent, pct_increase, FREELISTS,
freelist_groups, LOGGING, BUFFER_POOL, num_rows, blocks,
empty_blocks, avg_space, chain_cnt, avg_row_len, sample_size,
last_analyzed
FROM dba_tab_partitions
--WHERE table_name = :tname AND table_owner = :towner
ORDER BY partition_position

12、查看还没提交的事务
select * from v$locked_object;
select * from v$transaction;

13、查找object为哪些进程所用
select
p.spid,
s.sid,
s.serial# serial_num,
s.username user_name,
a.type object_type,
s.osuser os_user_name,
a.owner,
a.object object_name,
decode(sign(48 - command),
1,
to_char(command), 'Action Code #' || to_char(command) ) action,
p.program oracle_process,
s.terminal terminal,
s.program program,
s.status session_status
from v$session s, v$access a, v$process p
where s.paddr = p.addr and
s.type = 'USER' and
a.sid = s.sid and
a.object='SUBSCRIBER_ATTR'
order by s.username, s.osuser

14、回滚段查看
select rownum, sys.dba_rollback_segs.segment_name Name, v$rollstat.extents
Extents, v$rollstat.rssize Size_in_Bytes, v$rollstat.xacts XActs,
v$rollstat.gets Gets, v$rollstat.waits Waits, v$rollstat.writes Writes,
sys.dba_rollback_segs.status status from v$rollstat, sys.dba_rollback_segs,
v$rollname where v$rollname.name(+) = sys.dba_rollback_segs.segment_name and
v$rollstat.usn (+) = v$rollname.usn order by rownum

15、耗资源的进程(top session)
select s.schemaname schema_name, decode(sign(48 - command), 1,
to_char(command), 'Action Code #' || to_char(command) ) action, status
session_status, s.osuser os_user_name, s.sid, p.spid , s.serial# serial_num,
nvl(s.username, '[Oracle process]') user_name, s.terminal terminal,
s.program program, st.value criteria_value from v$sesstat st, v$session s , v$process p
where st.sid = s.sid and st.statistic# = to_number('38') and ('ALL' = 'ALL'
or s.status = 'ALL') and p.addr = s.paddr order by st.value desc, p.spid asc, s.username asc, s.osuser asc

16、查看锁(lock)情况
select /*+ RULE */ ls.osuser os_user_name, ls.username user_name,
decode(ls.type, 'RW', 'Row wait enqueue lock', 'TM', 'DML enqueue lock', 'TX',
'Transaction enqueue lock', 'UL', 'User supplied lock') lock_type,
o.object_name object, decode(ls.lmode, 1, null, 2, 'Row Share', 3,
'Row Exclusive', 4, 'Share', 5, 'Share Row Exclusive', 6, 'Exclusive', null)
lock_mode, o.owner, ls.sid, ls.serial# serial_num, ls.id1, ls.id2
from sys.dba_objects o, ( select s.osuser, s.username, l.type,
l.lmode, s.sid, s.serial#, l.id1, l.id2 from v$session s,
v$lock l where s.sid = l.sid ) ls where o.object_id = ls.id1 and o.owner
<> 'SYS' order by o.owner, o.object_name

17、查看等待(wait)情况
SELECT v$waitstat.class, v$waitstat.count count, SUM(v$sysstat.value) sum_value
FROM v$waitstat, v$sysstat WHERE v$sysstat.name IN ('db block gets',
'consistent gets') group by v$waitstat.class, v$waitstat.count

18、查看sga情况
SELECT NAME, BYTES FROM SYS.V_$SGASTAT ORDER BY NAME ASC

19、查看catched object
SELECT owner, name, db_link, namespace,
type, sharable_mem, loads, executions,
locks, pins, kept FROM v$db_object_cache

20、查看V$SQLAREA
SELECT SQL_TEXT, SHARABLE_MEM, PERSISTENT_MEM, RUNTIME_MEM, SORTS,
VERSION_COUNT, LOADED_VERSIONS, OPEN_VERSIONS, USERS_OPENING, EXECUTIONS,
USERS_EXECUTING, LOADS, FIRST_LOAD_TIME, INVALIDATIONS, PARSE_CALLS, DISK_READS,
BUFFER_GETS, ROWS_PROCESSED FROM V$SQLAREA

21、查看object分类数量
select decode (o.type#,1,'INDEX' , 2,'TABLE' , 3 , 'CLUSTER' , 4, 'VIEW' , 5 ,
'SYNONYM' , 6 , 'SEQUENCE' , 'OTHER' ) object_type , count(*) quantity from
sys.obj$ o where o.type# > 1 group by decode (o.type#,1,'INDEX' , 2,'TABLE' , 3
, 'CLUSTER' , 4, 'VIEW' , 5 , 'SYNONYM' , 6 , 'SEQUENCE' , 'OTHER' ) union select
'COLUMN' , count(*) from sys.col$ union select 'DB LINK' , count(*) from

22、按用户查看object种类
select u.name schema, sum(decode(o.type#, 1, 1, NULL)) indexes,
sum(decode(o.type#, 2, 1, NULL)) tables, sum(decode(o.type#, 3, 1, NULL))
clusters, sum(decode(o.type#, 4, 1, NULL)) views, sum(decode(o.type#, 5, 1,
NULL)) synonyms, sum(decode(o.type#, 6, 1, NULL)) sequences,
sum(decode(o.type#, 1, NULL, 2, NULL, 3, NULL, 4, NULL, 5, NULL, 6, NULL, 1))
others from sys.obj$ o, sys.user$ u where o.type# >= 1 and u.user# =
o.owner# and u.name <> 'PUBLIC' group by u.name order by
sys.link$ union select 'CONSTRAINT' , count(*) from sys.con$

23、有关connection的相关信息
1)查看有哪些用户连接
select s.osuser os_user_name, decode(sign(48 - command), 1, to_char(command),
'Action Code #' || to_char(command) ) action, p.program oracle_process,
status session_status, s.terminal terminal, s.program program,
s.username user_name, s.fixed_table_sequence activity_meter, '' query,
0 memory, 0 max_memory, 0 cpu_usage, s.sid, s.serial# serial_num
from v$session s, v$process p where s.paddr=p.addr and s.type = 'USER'
order by s.username, s.osuser
2)根据v.sid查看对应连接的资源占用等情况
select n.name,
v.value,
n.class,
n.statistic#
from v$statname n,
v$sesstat v
where v.sid = 71 and
v.statistic# = n.statistic#
order by n.class, n.statistic#
3)根据sid查看对应连接正在运行的sql
select /*+ PUSH_SUBQ */
command_type,
sql_text,
sharable_mem,
persistent_mem,
runtime_mem,
sorts,
version_count,
loaded_versions,
open_versions,
users_opening,
executions,
users_executing,
loads,
first_load_time,
invalidations,
parse_calls,
disk_reads,
buffer_gets,
rows_processed,
sysdate start_time,
sysdate finish_time,
'>' || address sql_address,
'N' status
from v$sqlarea
where address = (select sql_address from v$session where sid = 71)

24、查询表空间使用情况select a.tablespace_name "表空间名称",
100-round((nvl(b.bytes_free,0)/a.bytes_alloc)*100,2) "占用率(%)",
round(a.bytes_alloc/1024/1024,2) "容量(M)",
round(nvl(b.bytes_free,0)/1024/1024,2) "空闲(M)",
round((a.bytes_alloc-nvl(b.bytes_free,0))/1024/1024,2) "使用(M)",
Largest "最大扩展段(M)",
to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') "采样时间"
from (select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible,'YES',f.maxbytes,'NO',f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
(select f.tablespace_name,
sum(f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b,
(select round(max(ff.length)*16/1024,2) Largest,
ts.name tablespace_name
from sys.fet$ ff, sys.file$ tf,sys.ts$ ts
where ts.ts#=ff.ts# and ff.file#=tf.relfile# and ts.ts#=tf.ts#
group by ts.name, tf.blocks) c
where a.tablespace_name = b.tablespace_name and a.tablespace_name = c.tablespace_name

25、 查询表空间的碎片程度
select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name
having count(tablespace_name)>10;

alter tablespace name coalesce;
alter table name deallocate unused;

create or replace view ts_blocks_v as
select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space
union all
select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;

select * from ts_blocks_v;

select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space
group by tablespace_name;
re: ORACLE数据库启动关闭 孟和 2005-08-09 16:55  
二、用exp、imp命令做逻辑备份

1、输出export

基本命令:一般用交互方式,在oracle用户提示符下键入

% exp user/password í

exp 模式

①、table:export 某个用户模式下指定的table ;而不是所有的table ,而且不包括cluster定义;

②、user: export一个用户模式下所有的对象(如表、数据、索引等);

export 示例 user mode:

③、full database: export database 中所有的对象,执行这个必须被给

exp-full-database角色。

export 示例

A、dababase mode

% exp system/manager

... ... ...

enter array fetch buffer size :4096>(return)

export file :expdat.dmp >dba.dmp

e(ntire database),u(sers),t (ables):u>e

export grants (y/n):y>y

export table data (y/n):y>y

compress extents(y/n):y>y

B、table mode

% exp system/manager

... ... ...

enter array fetch buffer size :4096>(return)

export file :expdat.dmp >dba.dmp

e(ntire database),u(sers),t (ables):u>t

export grants (y/n):y>y

export table data (y/n):y>y

compress extents(y/n):y>y

About to exp specified tables ...

Table to be exported (RETURN quit) > emp ( 输入要输出的表名 )

.... exporting table EMP 14 rows exported

About to exp specified tables ...

Table to be exported (RETURN quit) > 如此循环下去,按回车退出

2、输入import

前提:在database建立之后,必须运行oracle-home /rdbms /admin/catexp.sql才能使用export,import。

权限:要使用 import ,必须要有create session 权限。如果要import 其它用户的表,必须要有imp_full_databade角色。(运行了catexp.sql后,dba就有了imp_full_database角色)。

字符:与export有关,只要两台机器的字符设置一样就没问题。

基本命令:一般用交互方式,在oracle用户提示符下键入

% imp user/password

imp 模式

①、table:允许用户import在用户模式下指定的table ,而不是所有的table;

②、user:允许用户import 属于用户本身所有的对象;

③、full database:允许用户import所有的database对象,必须被给予

imp-full-database角色。

import 示例

imp system/manager

...

import file :expdat.dmp>

enter insert buffer size (minimum is 4096)30720>

export file created by export:v 07.01.03

list contents of import file only(yds /no):no>

ignore create error due to obyict existence (yes /no):yes >

import grants (yes /no):yes>

import table data (yes /no):yes >

import entire export file (yes /no):yes >no

注意事项:

①、import 的权限必须大于、等于export的权限;

②、 对于long colums 由于对内存的特殊要求(需要地址连续的内存区)export 和 import有时不会成功;

③、对于备份到磁带上,export 和import 建议用同一台磁带机。

三、用tar命令做物理备份

1、#su - oracle

2、% tar cvf /dev/rmt/0 .

把oracle 路径下所有文件备份到磁带机上

3、% tar xvf /dev/rmt/0

把备份磁带上所有文件恢复进oracle 当前路径

4、% tar tvf /dev/rmt/0

查看磁带上有些什么文件

四、数据库的扩充

1、增加一个表空间

当我们要开发某个大型的应用程序时,最好建立一个相应的表空间。

命令示例:

SVRMGR>create tablespace application datafile

‘/usr/oracle/dbs/application.dbf’ size 3M

针对具体情况增加回滚和临时表空间

命令示例:

SVRMGR>create rollback tablespace rbs8 datafile

‘/usr/oracle/dbs/rbs8.dbf’ size 4M

SVRMGR>create tablespace tmp8 datafile

‘/usr/oracle/dbs/tmp8.dbf’ size 550K

回滚和临时表空间用完后,可删除或使它offline

SVRMGR>drop tablespace rbs8;

SVRMGR>drop tablespaces tmp8;

SVRMGR>alter tablespace rbs offline;

SVRMGR>alter tablespace tmp8 offline;

建立回滚段举例:

SVRMGR>create rollback segment rs11 tablespace tmp8 ;

SVRMGR>alter rollback segment rs11 online;

SVRMGR>alter rollback segment rs11 offline;

2、增加某个表空间的大小

当一个表空间的大小不能满足工作需要时,应该扩充表空间。

举例:

SVRMGR>alter tablespace system

add datafile ‘/usr/oracle/dbs/sys338.dbf’ size 3M;

五、增加oracle的用户,并给用户授权

1、增加oracle的用户, 并给用户授权

举例:

SVRMGR>create user newuser identified by userpasswd

default tablespace application

temporary tablespace tmp8;

SVRMGR>grant connect to newuser;

SVRMGR>grant resource to newuser;

SVRMGR>grant update on emp to newuser;

2、增加oracle的角色

oracle的缺省角色有connect、resource、dba。它是一组可以分配给其它role

或用户的权限总和,connect 有8个权限,resource 有5个权限,dba有77

个权限。给一般连接用户赋connect,给一般编程人员赋connect加resource,

只有数据库管理员才有dba的权限。

①创建一个角色

SVRMGR>create role newrole identified by rolepasswd;

②给角色赋权限

SVRMGR>grant select on all table to newrolle;

SVRMGR>grant connect to newrole with admin option;

3、中断用户同oracle的连接

当oracle数据库要关机或某个用户占有的大量的资源需要被释放时,dba

需中断用户同oracle的连接。

①、SVRMGR>select sid,serial#,username from v$session;

②、SVRMGR>alter system kill session ‘interger1,interger2’;

interger1,interger2分别对应于sid和serial#

http://www.dreamdak.com/show.aspx?id=706&cid=159
re: Solaris的硬件相关命令 孟和 2005-08-05 15:32  
prstat -- 处理器统计
re: 高晔钧的留言 孟和 2005-05-06 18:10  
应该是03年8月份就建立这个BLOG了吧,但是后来觉得当时写的那两篇日记太龌嵯了,所以删之!:)
至于后来又重新把它拿出来用就是去年11月开始实习后的事,当时想的是用它来做学习笔记的。
到现在发现其实很多东东都是从别人那里抄来的。偶尔自己写点日记、心得……
re: 集成测试 之 HttpUnit 孟和 2005-05-06 18:06  
TO Simon:
我对HttpUnit是业余了解的水平而已,我们这边的WEB测试主要靠手:)
JMeter我们倒是用来做压力测试的。
我基本就是做应用,对比较底层的东西了解的还是太少,你说的测试IO流的问题没太明白。我们做单元测试一般都是JUnit+Jakarta Commons Logging+Log4j,这样把需要输出的东西都打到日志里面看看。具体的你可以看看Log4j的文档,可以自定义输出流。最好不要直接System.out,影响编码质量^_^
回头在MSN上和你切磋吧。
re: 集成测试 之 HttpUnit Simon 2005-05-03 12:41  
你对HttpUnit研究的很深入吗?另外,请教一下,操作IO流类的函数或者对象,或者就是需要System.out的东西怎么进行单元测试?
re: 托娅的留言 孟和 2005-04-16 19:47  
呵呵,好的,等你建了博客一定第一时间告诉我:)
re: 移动数据增值业务综述 孟和 2005-03-31 12:42  
多为拼凑,欢迎大家指正!
re: 浅 谈 无 线 传 感 器 网 络 sditman 2005-03-24 16:12  
good job!

sditman@sdai.edu.cn