经典推荐: Oracle 常用命令汇总

来源:本站整理  作者:学生大读书站
摘要://创建一个控制文件命令到跟踪文件 alter database backup controlfile to trace;//增加一个新的日志文件组的语句 connect internal as sysdba alter database ……

//  tnsnames.ora 的条目
LOC=
  (DESCRIPTION=  
   (ADDRESS =
      (PROTOCOL = TCP)
      (HOST = HQ)
      (PORT = 1521))
  )
  (CONNECT_DATA =
    (SERVICE_NAME = loc)
    (INSTANCE_NAME = loc)
  )
)

//连接参数的设置(sql*net)
LOC =(DESCRIPTION=
    (ADDRESS=
          (COMMUNITY=TCP.HQ.COMPANY)
          (PROTOCOL=TCP)
          (HOST=HQ)
          (PORT=1521))
    (CONNECT DATA=
          (SID=loc)))
//参数文件配置范例
// tnsnames.ora 
HQ =(DESCRIPTION=
    (ADDRESS=
          (PROTOCOL=TCP)
          (HOST=HQ)
          (PORT=1521))
    (CONNECT DATA=
          (SID=loc)))

// listener.ora 
LISTENER =
  (ADDRESS_LIST =
      (ADDRESS=
        (PROTOCOL=IPC)
        (KEY= loc)
      )
   ) 
SID_LIST_LISTENER =
  (SID_LIST =
  (SID_DESC =
    (SID_NAME = loc)
    (ORACLE_HOME = /orasw/app/oracle/product/8.1.5.1)
)

// Oracle8I tnsnames.ora 
LOC=
  (DESCRIPTION=  
   (ADDRESS =
      (PROTOCOL = TCP)
      (HOST = HQ)
      (PORT = 1521))
  )
  (CONNECT_DATA =
    (SERVICE_NAME = loc)
    (INSTANCE_NAME = loc)
  )
)

//使用 COPY 实现数据库之间的复制
copy from
remote_username/remote_password@service_name
to
username/password@service_name
[append

create

insert

replace]
TABLE_NAME
using subquery;

REM  COPY example
set copycommit 1
set arraysize 1000
copy from HR/PUFFINSTUFF@loc -
create EMPLOYEE -
using -
select * from EMPLOYEE


//监视器的管理
lsnrctl start
lsnrctl start my_lsnr
lsnrctl status
lsnrctl status hq

检查监视器的进程
ps -ef

grep tnslsnr
//在 lsnrctl  内停止监视器
set password lsnr_password
stop

//在lsnrctl 内列出所有的服务
set password lsnr_password
services
//启动或停止一个NT的listener
net start Oracle<version_name>TNSListener
net stop Oracle<version_name>TNSListener

// tnsnames.ora 文件的内容
fld1 =
  (DESCRIPTION =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)
    (HOST = server1.fld.com)(PORT = 1521))
  )
  (CONNECT_DATA =
    (SID = fld1)
  )
  )
//操作系统网络的管理

telnet host_name
ping host_name
/etc/hosts 文件
130.110.238.109 nmhost
130.110.238.101 txhost
130.110.238.102 azhost  arizona 
//oratab 表项
loc:/orasw/app/oracle/product/8.1.5.1:Y
cc1:/orasw/app/oracle/product/8.1.5.1:N
old:/orasw/app/oracle/product/8.1.5.0:Y

【相关文章】好搜一下
Oracle数据库设计要做到五戒

Oracle数据库设计要做到五戒

众所周知,数据库设计的好坏直接关系到数据库运行的效率。根据笔者的经验,对于提升数…