# ----------------------------分割线------------------------------ # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. pathmunge () { case":${PATH}:"in *:"$1":*) ;; *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi esac }
if [ -x /usr/bin/id ]; then if [ -z "$EUID" ]; then # ksh workaround EUID=`id -u` UID=`id -ru` fi USER="`id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" fi # Path manipulation if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin else pathmunge /usr/local/sbin after pathmunge /usr/sbin after pathmunge /sbin after fi HOSTNAME=`/bin/hostname 2>/dev/null` HISTSIZE=1000 if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignoreboth else export HISTCONTROL=ignoredups fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null 2>&1 fi fi done unset i unset -f pathmunge # oracle home目录 export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2 # oracle 服务名或者 SID名,要记住这个名字helowin,它是naivcat登录的重要选项 export ORACLE_SID=helowin # oracle环境变量 export PATH=$ORACLE_HOME/bin:$PATH # ----------------------------分割线------------------------------
# 切换oracle用户su - oracle注意“-”的前后都一定要有空格 进入oracle (密码为oracle) sqlplus / as sysdba # 查看oracle数据库sid select instance_name from V$instance;
2.修改oracle默认超级管理员用户的登录密码并设置永不过期
1 2 3 4 5
# 此处的oracle就是设置的登录密码 SQL> alter user system identified by oracle; User altered. SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; Profile altered.
1. su - oracle 2. sqlplus / as sysdba 3. create user putong identified by oracle; # 创建一个普通用户 4. grant create session to putong; # 给putong登录权限 5. grant SELECT_CATALOG_ROLE to putong; # 给putong SELECT_CATALOG_ROLE权限