资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

做一名精致的DBA之glogin.sql

对于一个成熟的dba必须要熟悉glogin.sql这个文件,然后利用它,更好的规避一些操作风险。

1、查看glogin.sql内容

创新互联服务项目包括湘西土家族网站建设、湘西土家族网站制作、湘西土家族网页制作以及湘西土家族网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,湘西土家族网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到湘西土家族省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

$more glogin.sql
--
-- Copyright (c) 1988, 2011, Oracle and/or its affiliates. 
-- All rights reserved. 
--
-- NAME       ##文件名
--   glogin.sql
--
-- DESCRIPTION    ##描述
--   SQL*Plus global login "site profile" file
--
--   Add any SQL*Plus commands here that are to be executed when a
--   user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE   ##用法
--   This script is automatically run
--

实际上就是登陆数据库可以自动执行的一个脚本,简单可以这样理解。

2、添加内容
以下内容是我们可以添加的,我们根据我们的需要添加。

SQL> define
DEFINE _DATE           = "13-FEB-2018 21:05:01" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "orcl" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1102000400" (CHAR)
DEFINE _EDITOR         = "ed" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options" (CHAR)
DEFINE _O_RELEASE      = "1102000400" (CHAR)
SQL>                  

这里我添加几个常用的,也是我在生产环境上添加的。

set linesize 200 pagesize 50
set sqlprompt "_user'@'_connect_identifier> "
define_editor=vi

添加的文件内容

$vi glogin.sql 
--
-- Copyright (c) 1988, 2011, Oracle and/or its affiliates. 
-- All rights reserved. 
--
-- NAME
--   glogin.sql
--
-- DESCRIPTION
--   SQL*Plus global login "site profile" file
--
--   Add any SQL*Plus commands here that are to be executed when a
--   user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
--   This script is automatically run
--
set linesize 132 pagesize 50
set sqlprompt "_user'@'_connect_identifier> "
define_editor=vi

3、大家看一下结果:

$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 13 21:13:40 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@orcl> 

小结:
当我们管理多套数据库的时候,可能同时登陆到几套数据库,为了防止出现操作失误的情况,建议大家配置一下glogin.sql,可以时刻提示我们在那套数据库上进行操作,对数据库的操作多谨慎都不为过。


分享名称:做一名精致的DBA之glogin.sql
分享路径:http://cdkjz.cn/article/goggcj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220