Get the App
SLTechnology News&Howtos  ›  Database  › 

Be an exquisite glogin.sql of DBA

Shulou Source: shulou.com Published: 2022-06-01 09:09:15 09月30日 Update

For a mature dba, you must be familiar with the glogin.sql file, and then use it to better avoid some operational risks.

1. View glogin.sql content

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

It is actually a script that can be executed automatically by logging in to the database, which can be understood in this way.

2. Add content

The following is something we can add, and we can add it according to our needs.

SQL > defineDEFINE _ 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 ProductionWith the Partitioning, OLAP Data Mining and Real Application Testing options "(CHAR) DEFINE _ O_RELEASE =" 1102000400 "(CHAR) SQL >

Here I add a few commonly used ones, which I also added in the production environment.

Set linesize 200 pagesize 50set sqlprompt "_ user'@'_connect_identifier >" define_editor=vi

Added contents of the file

$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 Amuri-user starts SQL*Plus, or uses the SQL*Plus CONNECT command.---- USAGE-- This script is automatically run--set linesize 132pagesize 50set sqlprompt "_ user'@'_connect_identifier >" define_editor=vi

3. Let's take a look at the results:

Sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 13 21:13:40 2018Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSYS@orcl >

Summary:

When we manage multiple sets of databases, we may log in to several sets of databases at the same time. In order to prevent operational errors, it is recommended that we configure glogin.sql, which can always prompt us to operate on that set of databases. We cannot be too cautious about the operation of the database.

Tags: Data database content files login maturity not too much at the same time multiple sets actual in fact summary that is commonly used suggestions situations file names time moment environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL NVidia Xiaomi Huawei Linux