📄
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0055)http://www.hzsdb.com.cn/oracle/adminscript/myscript.htm -->
<HTML><HEAD><TITLE>Untitled Document</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="有用的oracle脚本.files/mycss.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<TABLE class=mycss width="100%" border=0>
<TBODY>
<TR>
<TD width=608><IMG height=50 src="有用的oracle脚本.files/banner.jpg"
width=600></TD>
<TD width=125 height=52>
<P class=mycss>
<SCRIPT language=JavaScript>today=new Date();function initArray(){this.length=initArray.arguments.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");document.write("<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",today.getYear(),"/",today.getMonth()+1,"/",today.getDate()," ",d[today.getDay()+1],"</font>" ); </SCRIPT>
</P></TD></TR></TBODY></TABLE>
<TABLE width="100%" border=0>
<TBODY>
<TR bgColor=#66ccff>
<TD width="14%" bgColor=#66ccff>
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/index.htm">首页</A></DIV></TD>
<TD width="14%" bgColor=#66ccff>
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/install/index.htm">安装</A></DIV></TD>
<TD width="14%" bgColor=#6699ff>
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/adminscript/index.htm">管理</A></DIV></TD>
<TD width="14%">
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/proc/index.htm">Pro*C</A></DIV></TD>
<TD width="14%">
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/ocp/index.htm">OCP</A></DIV></TD>
<TD width="15%">
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/download/index.htm">下载</A></DIV></TD>
<TD width="15%">
<DIV align=center><A
href="http://www.hzsdb.com.cn/oracle/forum/index.php">论坛</A></DIV></TD></TR></TBODY></TABLE>
<TABLE width="100%" border=0><!--DWLayoutTable-->
<TBODY>
<TR>
<TD>
<P>操作系统级查看进程</P>
<P>ps -ef |grep oracle|grep SID<BR>exp userid=username/password@remote
tables=(table1,table2) file=my.dmp<BR>imp userid=localname/localpasswd
tables=(table1,table2) file=my.dmp</P>
<P> </P>
<P>联机热备份backuporacle.sql</P>
<P>alter database backup controlfile to
'/u02/backup/control.bak';<BR>alter database backup controlfile to
trace;<BR>host cp /u02/app/oracle/admin/myTest/pfile/initmyTest.ora
/u02/backup;<BR>host cp /u02/app/oracle/admin/myTest/udump/*.trc
/u02/backup;<BR>alter system switch logfile;</P>
<P>alter tablespace TOOLS begin backup;<BR>host cp
/u02/app/oracle/oradata/myTest/tools*.dbf /u02/backup;<BR>alter tablespace
TOOLS end backup;<BR>alter system switch logfile;</P>
<P>alter tablespace RBS begin backup;<BR>host cp
/u02/app/oracle/oradata/myTest/rbs*.dbf /u02/backup;<BR>alter tablespace
RBS end backup;<BR>alter system switch logfile;</P>
<P>alter tablespace TEMP begin backup;<BR>host cp
/u02/app/oracle/oradata/myTest/temp*.dbf /u02/backup;<BR>alter tablespace
TEMP end backup;<BR>alter system switch logfile;</P>
<P>alter tablespace SYSTEM begin backup;<BR>host cp
/u02/app/oracle/oradata/myTest/system*.dbf /u02/backup;<BR>alter
tablespace SYSTEM end backup;<BR>alter system switch logfile;</P>
<P>alter tablespace INDX begin backup;<BR>host cp
/u02/app/oracle/oradata/myTest/indx*.dbf /u02/backup;<BR>alter tablespace
INDX end backup;<BR>alter system switch logfile;</P>
<P>alter tablespace USERS begin backup;<BR>host cp
/u02/app/oracle/oradata/myTest/users*.dbf /u02/backup;<BR>alter tablespace
USERS end backup;<BR>alter system switch logfile;<BR>exit</P>
<P> </P>
<P>表空间大小</P>
<P>select
tablespace_name,count(*),sum(blocks),sum(bytes)/1024/1024<BR>from
dba_data_files<BR>group by tablespace_name;</P>
<P> </P>
<P>表空间使用情况</P>
<P>select df.tablespace_name "表空间名",totalspace "总空间M",freespace
"剩余空间M",round((1-freespace/totalspace)*100,2) "使用率%"<BR>from <BR>(select
tablespace_name,round(sum(bytes)/1024/1024) totalspace<BR>from
dba_data_files<BR>group by tablespace_name) df,<BR>(select
tablespace_name,round(sum(bytes)/1024/1024) freespace<BR>from
dba_free_space<BR>group by tablespace_name) fs<BR>where
df.tablespace_name=fs.tablespace_name;</P>
<P> </P>
<P>删除表空间</P>
<P>select t.name,d.name from v$tablespace t,v$datafile d where
t.name='DATA_HOST_A' and t.ts#=d.ts#;<BR>alter tablespace DATA_HOST_A
offline;<BR>drop tablespace DATA_HOST_A including contents;</P>
<P> </P>
<P>转换成archive模式</P>
<P>shutdown immediate<BR>改init文件<BR>start mount<BR>alter database
achivelog;<BR>alter database open;<BR></P></TD></TR></TBODY></TABLE>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD width="42%"><A href="mailto:oracle@hzsdb.com.cn">给我写信</A>
qq:7321473</TD>
<TD width="58%">
<DIV align=right>网站所有内容均为个人学习所用。如有侵权,本章立即删除。
</DIV></TD></TR></TBODY></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -