Oracle 11gR2安装(Centos7 命令行方式)

Oracle 11gR2安装(Centos 7 命令行方式)

准备

软件包

Oracle 11gR2 64位 Linux版安装包(可以通过Oracle官网直接下载)

官方地址
<Oracle_Server>
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html

软件包:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

<Oracle_Client>
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win64soft-094461.html

软件包:
win64_11gR2_client.zip

<PLSQL>
http://www.pcsoft.com.cn/soft/175428.html

<TOAD>
https://www.7down.com/soft/297038.html
私有地址
https://blog.csdn.net/hatzhou/article/details/80914847#commentBox
本地包
[服务器]  10.47.85.136
[文件列表] $ ll /home/oraclepackage
[服务端]
-rw-r--r-- 1 root root 1239269270 4月  16 15:25 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root root 1111416131 4月  16 15:25 linux.x64_11gR2_database_2of2.zip
[客户端]
-rw-r--r-- 1 root root  615698264 4月  17 08:40 win64_11gR2_client.zip

内存调整

操作用户:root
@ 最低内存需求
Checking Temp space: must be greater than 120 MB.   Actual 20490 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4095 MB    Passed

@ 查询当前内存
# grep MemTotal /proc/meminfo
MemTotal:       131154468 kB

# grep SwapTotal /proc/meminfo
SwapTotal:       4194300 kB

# free -h
              total        used        free      shared  buff/cache   available
Mem:           125G        6.4G         99G        4.1G         18G        113G
Swap:          4.0G          0B        4.0G

@ swap空间不足解决方法
# free -m  //查看当前虚拟内存
# dd if=/dev/zero of=/home/swap bs=1024 count=1024000 //将当前swap空间由2048M增加到3048M新增一个1024的swap文件
# mkswap /home/swap  //格式化swap分区
# swapon /home/swap //增加并启用虚拟内存
# free -m  //再次查看

安装依赖

操作用户:root
@ 注意:依赖可能部分安装失败,但不影响oracle安装
<安装>
yum -y install binutils compat-libcap1 compat-libstdc++-33 \
compat-libstdc++-33*i686 compat-libstdc++-33*.devel \
compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ \
glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio \
libaio*.i686 libaio-devel libaio-devel*.devel libgcc \
libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel \
libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 \
make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

<检查>
rpm -q binutils compat-libcap1 compat-libstdc++-33 \
compat-libstdc++-33*i686 compat-libstdc++-33*.devel \
compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ \
glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio \
libaio*.i686 libaio-devel libaio-devel*.devel libgcc \
libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel \
libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 \
make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

@ 依赖安装后,执行更新操作:
# yum update

配置内核

操作用户:root
@ 增加配置(如已存在可不添加,注意修改后是否会对原有应用造成影响)
#  vim  /etc/sysctl.conf
# Kernel paramaters required by Oracle 11gR1 
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

@ 注意: kernel.shmmax 的值是物理内存的一半。
@ 保存并使之生效:
# /sbin/sysctl -p
 
@ 如果有如下提示错误,忽略!
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key

配置pam

操作用户:root
@ 增加配置
# vim /etc/pam.d/login

session required pam_limits.so
session required /lib/security/pam_limits.so (按需配置:32位系统)
session required /lib64/security/pam_limits.so (按需配置:64位系统)

oracle资源限制

操作用户:root
@ 增加配置
# vim /etc/profile
 
if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
  ulimit -p 16384
  ulimit -n 65536
 else
  ulimit -u 16384 -n 65536
 fi
fi

创建用户组

操作用户:root
@ 创建用户及组
# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba -d /home/oracle oracle
# passwd oracle   (密码:Oracle#123456)

解压安装包

操作用户:root
@ Oracle 11gR2安装包上传到/home/oracle,然后顺序解压:
# unzip linux.x64_11gR2_database_1of2.zip
# unzip linux.x64_11gR2_database_2of2.zip

修改安全设置

操作用户:root
@ 文件追加如下内容:
# vi /etc/security/limits.conf
oracle  soft  nproc 2047
oracle  hard  nproc 16384
oracle  soft  nofile  1024
oracle  hard  nofile  65536

关闭防火墙

操作用户:root
【关闭】
# systemctl stop firewalld.service
【禁用】
# systemctl disable firewalld.service

创建安装目录

操作用户:oracle
$ mkdir -p /home/oracle/tools/oracle11g

修改环境变量

操作用户:oracle
@ 文件追加如下内容:
$ vi /home/oracle/.bash_profile
export ORACLE_BASE=/home/oracle/tools/oracle11g
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export NLS_LANG=.AL32UTF8
export PATH=${PATH}:${ORACLE_HOME}/bin/:$ORACLE_HOME/lib64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export TNS_ADMIN=/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/network/admin
@ 生效配置:
$ source ~/.bash_profile

定义安装响应文件

操作用户:oracle
@ 注意:模板内容修改如下(目录、用户等没有变化的情况下,可以直接使用)。
$ cp /home/oracle/database/response/db_install.rsp /home/oracle
$ vi db_install.rsp

####################################################################
## Copyright(c) Oracle Corporation 1998,2008. All rights reserved.##
##                                                                ##
## Specify values for the variables listed below to customize     ##
## your installation.                                             ##
##                                                                ##
## Each variable is associated with a comment. The comment        ##
## can help to populate the variables with the appropriate        ##
## values.                                                        ##
##                                                                ##
## IMPORTANT NOTE: This file contains plain text passwords and    ##
## should be secured to have read permission only by oracle user  ##
## or db administrator who owns this installation.                ##
##                                                                ##
####################################################################

#------------------------------------------------------------------------------
# Do not change the following system generated value.
#------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

#------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# 1. INSTALL_DB_SWONLY
# 2. INSTALL_DB_AND_CONFIG
# 3. UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_AND_CONFIG

#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=localhost

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/home/oracle/tools/oraInventory

#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.
#
# en   : English                  ja   : Japanese
# fr   : French                   ko   : Korean
# ar   : Arabic                   es   : Latin American Spanish
# bn   : Bengali                  lv   : Latvian
# pt_BR: Brazilian Portuguese     lt   : Lithuanian
# bg   : Bulgarian                ms   : Malay
# fr_CA: Canadian French          es_MX: Mexican Spanish
# ca   : Catalan                  no   : Norwegian
# hr   : Croatian                 pl   : Polish
# cs   : Czech                    pt   : Portuguese
# da   : Danish                   ro   : Romanian
# nl   : Dutch                    ru   : Russian
# ar_EG: Egyptian                 zh_CN: Simplified Chinese
# en_GB: English (Great Britain)  sk   : Slovak
# et   : Estonian                 sl   : Slovenian
# fi   : Finnish                  es_ES: Spanish
# de   : German                   sv   : Swedish
# el   : Greek                    th   : Thai
# iw   : Hebrew                   zh_TW: Traditional Chinese
# hu   : Hungarian                tr   : Turkish
# is   : Icelandic                uk   : Ukrainian
# in   : Indonesian               vi   : Vietnamese
# it   : Italian
#
# Example : SELECTED_LANGUAGES=en,fr,ja
#------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#------------------------------------------------------------------------------
ORACLE_HOME=/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#------------------------------------------------------------------------------
ORACLE_BASE=/home/oracle/tools/oracle11g

#------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# EE     : Enterprise Edition
# SE     : Standard Edition
# SEONE  : Standard Edition One
# PE     : Personal Edition (WINDOWS ONLY)
#------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE

#------------------------------------------------------------------------------
# This variable is used to enable or disable custom install.
#
# true  : Components mentioned as part of 'customComponents' property
#         are considered for install.
# false : Value for 'customComponents' is not considered.
#------------------------------------------------------------------------------
oracle.install.db.isCustomInstall=false

#------------------------------------------------------------------------------
# This variable is considered only if 'IsCustomInstall' is set to true.
#
# Description: List of Enterprise Edition Options you would like to install.
#
#              The following choices are available. You may specify any
#              combination of these choices.  The components you choose should
#              be specified in the form "internal-component-name:version"
#              Below is a list of components you may specify to install.
#
#              oracle.rdbms.partitioning:11.2.0.1.0 - Oracle Partitioning
#              oracle.rdbms.dm:11.2.0.1.0 - Oracle Data Mining
#              oracle.rdbms.dv:11.2.0.1.0 - Oracle Database Vault
#              oracle.rdbms.lbac:11.2.0.1.0 - Oracle Label Security
#              oracle.rdbms.rat:11.2.0.1.0 - Oracle Real Application Testing
#              oracle.oraolap:11.2.0.1.0 - Oracle OLAP
#------------------------------------------------------------------------------
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0

###############################################################################
#                                                                             #
# PRIVILEGED OPERATING SYSTEM GROUPS                                          #
# ------------------------------------------                                  #
# Provide values for the OS groups to which OSDBA and OSOPER privileges       #
# needs to be granted. If the install is being performed as a member of the   #
# group "dba", then that will be used unless specified otherwise below.       #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba

#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=oinstall

#------------------------------------------------------------------------------
# Specify the cluster node names selected during the installation.
#------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES=

#------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE/TRANSACTION_PROCESSING
# - DATA_WAREHOUSE
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

#------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=orcl

#------------------------------------------------------------------------------
# Specify the Starter Database SID.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orcl

#------------------------------------------------------------------------------
# Specify the Starter Database character set.
#
# It can be one of the following:
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=AL32UTF8

#------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=true

#------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=512

#------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto the starter
# database or not.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=false

#------------------------------------------------------------------------------
# This variable includes enabling audit settings, configuring password profiles
# and revoking some grants to public. These settings are provided by default.
# These settings may also be disabled.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableSecuritySettings=true

###############################################################################
#                                                                             #
# Passwords can be supplied for the following four schemas in the             #
# starter database:                                                           #
#   SYS                                                                       #
#   SYSTEM                                                                    #
#   SYSMAN (used by Enterprise Manager)                                       #
#   DBSNMP (used by Enterprise Manager)                                       #
#                                                                             #
# Same password can be used for all accounts (not recommended)                #
# or different passwords for each account can be provided (recommended)       #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=Oracle#123456

#-------------------------------------------------------------------------------
# Specify the SYS password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYS=

#-------------------------------------------------------------------------------
# Specify the SYSTEM password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSTEM=

#-------------------------------------------------------------------------------
# Specify the SYSMAN password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSMAN=

#-------------------------------------------------------------------------------
# Specify the DBSNMP password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP=

#-------------------------------------------------------------------------------
# Specify the management option to be selected for the starter database.
# It can be one of the following:
# 1. GRID_CONTROL
# 2. DB_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.control=DB_CONTROL

#-------------------------------------------------------------------------------
# Specify the Management Service to use if Grid Control is selected to manage
# the database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

#-------------------------------------------------------------------------------
# This variable indicates whether to receive email notification for critical
# alerts when using DB control.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

#-------------------------------------------------------------------------------
# Specify the email address to which the notifications are to be sent.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.emailAddress=lijie@zte.com

#-------------------------------------------------------------------------------
# Specify the SMTP server used for email notifications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=


###############################################################################
#                                                                             #
# SPECIFY BACKUP AND RECOVERY OPTIONS                                         #
# ------------------------------------                                        #
# Out-of-box backup and recovery options for the database can be mentioned    #
# using the entries below.                                                    #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# This variable is to be set to false if automated backup is not required. Else
# this can be set to true.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.enable=false

#------------------------------------------------------------------------------
# Regardless of the type of storage that is chosen for backup and recovery, if
# automated backups are enabled, a job will be scheduled to run daily at
# 2:00 AM to backup the database. This job will run as the operating system
# user that is specified in this variable.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.osuid=

#-------------------------------------------------------------------------------
# Regardless of the type of storage that is chosen for backup and recovery, if
# automated backups are enabled, a job will be scheduled to run daily at
# 2:00 AM to backup the database. This job will run as the operating system user
# specified by the above entry. The following entry stores the password for the
# above operating system user.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.ospwd=

#-------------------------------------------------------------------------------
# Specify the type of storage to use for the database.
# It can be one of the following:
# - FILE_SYSTEM_STORAGE
# - ASM_STORAGE
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE

#-------------------------------------------------------------------------------
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/tools/oracle11g/oradata

#-------------------------------------------------------------------------------
# Specify the backup and recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/tools/oracle11g/fast_recovery_area

#-------------------------------------------------------------------------------
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.diskGroup=

#-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_SYSTEM
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
#  Example   : MYORACLESUPPORT_USERNAME=metalink
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example    : MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=

#------------------------------------------------------------------------------
# Specify whether user wants to give any proxy details for connection.
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true

#------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example    : PROXY_HOST=proxy.domain.com
#------------------------------------------------------------------------------
PROXY_HOST=

#------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and atleast 2 chars.
#
# Example    : PROXY_PORT=25
#------------------------------------------------------------------------------
PROXY_PORT=

#------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_USER=username
#------------------------------------------------------------------------------
PROXY_USER=

#------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_PWD=password
#------------------------------------------------------------------------------
PROXY_PWD=

静默安装Oracle 11gR2

操作用户:oracle
@ 操作目录:/home/oracle/database
@ 命令:
【方式1】【屏蔽异常信息】
$ ./runInstaller -silent -ignorePrereq -responseFile /home/oracle/db_install.rsp
【方式2】【屏蔽部分异常信息,会有警告,可忽略】
$ ./runInstaller -silent -ignoreSysPrereqs -responseFile /home/oracle/db_install.rsp
>>>>>>
        正在启动 Oracle Universal Installer...
        检查临时空间: 必须大于 120 MB。   实际为 38740 MB    通过
        检查交换空间: 必须大于 150 MB。   实际为 4095 MB    通过
        准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2019-04-16_03-41-22PM. 请稍候...[oracle@jetflow136 database]$ 可以在以下位置找到本次安装会话的日志:
        /home/oracle/tools/oraInventory/logs/installActions2019-04-16_03-41-22PM.log

安装结束后会打印如下信息:
        The following configuration scripts need to be executed as the "root" user.
        #!/bin/sh
        #Root scripts to run
        /home/oracle/tools/oraInventory/orainstRoot.sh
        /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/root.sh
        To execute the configuration scripts:
         1. Open a terminal window         
         2. Log in as "root"         
         3. Run the scripts         
         4. Return to this window and hit "Enter" key to continue
        Successfully Setup Software.
<<<<<<

@ 注意:如果需要查询安装过程日志,请重新开个终端,使用命令:tailf /home/oracle/tools/oraInventory/logs/installActions2019-04-16_03-41-22PM.log 打印日志。
@ 告警:只要不会导致程序退出,即可忽略一些警告异常。

@ 重复安装清理操作:
$ rm -rf /etc/oratab
$ rm -rf /home/oracle/tools
$ mkdir -p /home/oracle/tools/oracle11g

完成安装

操作用户:root

根据上一步完成信息提示,执行以下两行命令,具体位置需要根据你的安装位置决定。

# /home/oracle/tools/oraInventory/orainstRoot.sh
# /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/root.sh

验证安装

启停数据库实例orcl

操作用户:oracle
启动oracle实例:
$ sqlplus /nolog
SQL> connect / as sysdba 
SQL> startup  (默认安装后自启动)
SQL> startup force (强制启动)
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size                  2215064 bytes
Variable Size             360711016 bytes
Database Buffers          159383552 bytes
Redo Buffers               12152832 bytes
Database mounted.
Database opened.

@ 查询启动状态
SQL> select status from v$instance;

STATUS
------------
OPEN
停oracle实例:
$ sqlplus /nolog
SQL> connect / as sysoper
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

启动监听

操作用户:oracle
配置文件:
@ 可查询启动的监听端口
/etc/oratab
/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora
/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
启停监听:
$ lsnrctl stop

$ lsnrctl start  (启动后等待5秒再检查)
监听状态:
$ lsnrctl status

>>>>>>

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JAN-2018 12:52:45
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                05-JAN-2018 12:49:29
Uptime                    0 days 0 hr. 3 min. 16 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /home/oracle/tools/oracle11g/diag/tnslsnr/vmco0240/listener/alert/log.xml
Listening Endpoints Summary...  
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vmco0240)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).  
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).  
Instance "orcl", status READY, has 1 handler(s) for this service...The command completed successfully

建表空间

@创建存储目录
$ mkdir -p /home/oracle/oradata/ufgov

@ 连接数据库
$ sqlplus /nolog
SQL> connect / as sysdba

@ 查询表空间
SQL> SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size FROM dba_tablespaces t, dba_data_files d WHERE t.tablespace_name = d.tablespace_name GROUP BY t.tablespace_name; 

@ 创建表空间,表空间路径可以在其他盘符
SQL> create tablespace UFGOV datafile '/home/oracle/oradata/ufgov/UFGOV.dbf' size 500m reuse autoextend on next 1m maxsize unlimited;

@ 创建临时表空间,表空间路径可以在其他盘符
SQL> create temporary tablespace UFGOV_TEMP tempfile '/home/oracle/oradata/ufgov/UFGOV_TEMP.dbf' size 500m reuse autoextend on next 1m maxsize unlimited;

@ 创建用户,指定表空间,临时表空间
SQL> create user usrufgov identified by usrufgov default tablespace UFGOV temporary tablespace UFGOV_TEMP;

@ DBA权限,授予用户数据库管理员权限
SQL> grant dba,connect,resource,imp_full_database,exp_full_database to usrufgov;
(或者 grant all privileges to usrufgov;)

@ 授予用户创建权限
SQL> grant create session to usrufgov;
SQL> grant execute on SYS.DBMS_DEFER_IMPORT_INTERNAL to usrufgov;
SQL> grant execute on SYS.DBMS_EXPORT_EXTENSION to usrufgov;

@ 可选权限sysdba、sysoper
SQL> grant sysdba to usrufgov;
SQL> grant sysoper to usrufgov;

@ 设置在用户 usrufgov 在 UFGOV 表空间配额不受限。
SQL> alter user usrufgov quota unlimited on UFGOV;

@ 提交修改
SQL> commit;

【附录】
drop tablespace UFGOV including contents and datafiles cascade constraints; -----删除表空间
drop tablespace UFGOV_TEMP including contents and datafiles cascade constraints; -----删除临时表空间
drop user usrufgov cascade;  ------删除用户

导入导出

exp(导出)和(imp)导入

缺点:导入导出的速度相对较慢。

【完整导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
exp usrufgov/usrufgov@orcl file=/home/oracle/ufgov.dmp full = y

[导入]
imp usrufgov/usrufgov file=/home/oracle/ufgov.dmp full=y ignore=y statistics=none
====================================================================================================================

【用户库导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
exp userid=usrufgov/usrufgov@orcl owner=usrufgov file=/home/oracle/ufgov.dmp log=ufgov.log buffer=67108864 statistics=none grants=n consistent=y

[导入]
imp usrufgov/usrufgov file=/home/oracle/ufgov.dmp log=ufgov.log fromuser=usrufgov touser=usrufgov
====================================================================================================================

【指定表导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
exp usrufgov/usrufgov@orcl file=/home/oracle/ufgov.dmp tables=\(STUDENT\) log=ufgov.log buffer=67108864 statistics=none grants=n consistent=y

[导入]
imp usrufgov/usrufgov file=/home/oracle/ufgov.dmp tables=\(STUDENT\) ignore=y statistics=none
====================================================================================================================

【指定表结构导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
exp usrufgov/usrufgov@orcl file=/home/oracle/ufgov.dmp tables=\(STUDENT\) log=ufgov.log buffer=67108864 statistics=none grants=n consistent=y rows=n 

[导入]
imp usrufgov/usrufgov file=/home/oracle/ufgov.dmp tables=\(STUDENT\) ignore=y statistics=none
====================================================================================================================

【带where条件导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
exp usrufgov/usrufgov@orcl file=/home/oracle/ufgov.dmp tables=\(STUDENT\) query=\"where SNO like '10%'\"

[导入]
imp usrufgov/usrufgov@orcl file=/home/oracle/ufgov.dmp full=y fromuser=user1 touser=user2;
====================================================================================================================
expdp导出和(impdp)导入

优点:导入导出速度相对较快。

【注意事项】
1)只能在安装了Oracle的机器上使用
2)需要先创建逻辑目录dump_dir ,在sysdba权限用户下执行sql如下:

【检查导出目录】
SQL> select * from dba_directories; 
@ 如果不存在则新增:
$ mkdir -p /home/oracle/expdp
SQL> create directory dump_dir as '/home/oracle/expdp';
SQL> grant read,write on directory dump_dir to usrufgov;

【用户库导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
expdp usrufgov/usrufgov@orcl schemas=usrufgov dumpfile=ufgov.dmp directory=dump_dir;
或:
expdp "'sys/sys as sysdba'" schemas=usrufgov dumpfile=ufgov.dmp directory=dump_dir;

Schemas:用户
Directory:oracle导出目录
exclude=statistics :不包括统计信息
dumpfile:导出的文件名
Logfile:导出的日志记录

[导入][相同用户]
impdp usrufgov/usrufgov@orcl directory=dump_dir dumpfile=ufgov.dmp schemas=usrufgov commit=y ignore=y
或:
impdp "'sys/sys as sysdba'" directory=dump_dir dumpfile=ufgov.dmp schemas=usrufgov commit=y ignore=y

remap_schema:备份中的用户:还原的目标用户
Directory:oracle导入导出目录
Parallel:并行度(线程)
remap_tablespace:备份文件中的表空间:导入的表空间
dumpfile:寻找备份的文件名
logfile:输出日志名字

[导入][不同用户->userB]
impdp usrufgov/usrufgov@orcl directory=dump_dir dumpfile=ufgov.dmp remap_schema=usrufgov:userB commit=y ignore=y
====================================================================================================================

【指定表导出导入】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[导出]
expdp usrufgov/usrufgov@orcl tables=STUDENT,MA_BANK_ACC dumpfile=ufgov.dmp directory=dump_dir;

[导入][相同用户]
impdp usrufgov/usrufgov@orcl directory=dump_dir dumpfile=ufgov.dmp tables=STUDENT,MA_BANK_ACC

[导入][不同用户->userB]
impdp usrufgov/usrufgov@orcl directory=dump_dir dumpfile=ufgov.dmp tables=STUDENT,MA_BANK_ACC remap_schema=usrufgov:userB
====================================================================================================================
导入sql
SQL> connect usrufgov/usrufgov
SQL> show user;
SQL> @/home/oracle/three.sql

plsql连接串

Name: usrufgov  
Password: usrufgov
Database: 10.47.85.216:1526/ORCL   (1521,1526以实际情况为准)

建表+构造数据

--建表
--student表+注释
create table student(
       sno   varchar2(3) not null,
       sname varchar2(9) not null,
       ssex  varchar2(3) not null,
       sbirthday date,
       sclass varchar2(5),
       constraint pk_student primary key(sno)
);
comment on column student.sno is '学号(主键)';
comment on column student.sname is '学生姓名';
comment on column student.ssex is '学生性别';
comment on column student.sbirthday is '学生出生年月日';
comment on column student.sclass is '学生所在班级';
--course表+注释
create table course(
       cno       varchar2(5) not null,
       cname     varchar2(15) not null,
       tno       varchar2(3) not null,
       constraint pk_course primary key(cno)
);
comment on column course.cno is '课程编号(主键)';
comment on column course.cname is '课程名称';
comment on column course.tno is '教工编号(外键)';
--score表+注释
create table score(
        sno   varchar2(3) not null,
        cno   varchar2(5) not null,
        degree   number(4,1),
        constraint pk_score primary key(sno,cno)
);
comment on column score.sno is '学号(主键)';
comment on column score.cno is '课程编号(主键)';
comment on column score.degree is '成绩';
--teacher表+注释
create table teacher(
       tno   varchar2(3) not null,
       tname varchar2(9) not null,
       tsex  varchar2(3) not null,
       tbirthday date,
       prof  varchar2(9),
       depart varchar2(15) not null,
       constraint pk_teacher primary key(tno)
);
comment on column teacher.tno is '教工编号(主键)';
comment on column teacher.tname is '教工姓名';
comment on column teacher.tsex is '教工性别';
comment on column teacher.tbirthday is '教工出生年月';
comment on column teacher.prof is '职称';
comment on column teacher.depart is '教工所在单位';
--添加外键
alter table course add constraint fk_tno foreign key(tno) references teacher(tno);
alter table score add constraint fk_sno foreign key(sno) references student(sno);
alter table score add constraint fk_cno foreign key(cno) references course(cno); 
--添加数据
--Student表
insert into student(sno,sname,ssex,sbirthday,sclass) values(108,'曾华','男',to_date('1977-09-01','yyyy-mm-dd'),95033);
insert into student(sno,sname,ssex,sbirthday,sclass) values(105,'匡明','男',to_date('1975-10-02','yyyy-mm-dd'),95031);
insert into student(sno,sname,ssex,sbirthday,sclass) values(107,'王丽','女',to_date('1976-01-23','yyyy-mm-dd'),95033);
insert into student(sno,sname,ssex,sbirthday,sclass) values(101,'李军','男',to_date('1976-02-20','yyyy-mm-dd'),95033);
insert into student(sno,sname,ssex,sbirthday,sclass) values(109,'王芳','女',to_date('1975-02-10','yyyy-mm-dd'),95031);
insert into student(sno,sname,ssex,sbirthday,sclass) values(103,'陆君','男',to_date('1974-06-03','yyyy-mm-dd'),95031);
--teacher表
insert into teacher(tno,tname,tsex,tbirthday,prof,depart) values(804,'李诚','男',to_date('1958/12/02','yyyy-mm-dd'),'副教授','计算机系');
insert into teacher(tno,tname,tsex,tbirthday,prof,depart) values(856,'张旭','男',to_date('1969/03/12','yyyy-mm-dd'),'讲师','电子工程系');
insert into teacher(tno,tname,tsex,tbirthday,prof,depart) values(825,'王萍','女',to_date('1972/05/05','yyyy-mm-dd'),'助教','计算机系');
insert into teacher(tno,tname,tsex,tbirthday,prof,depart) values(831,'刘冰','女',to_date('1977/08/14','yyyy-mm-dd'),'助教','电子工程系');
--course表(添加外键后要先填teacher表中数据去满足外键约束)
insert into course(cno,cname,tno) values('3-105','计算机导论',825);
insert into course(cno,cname,tno) values('3-245','操作系统',804);
insert into course(cno,cname,tno) values('6-166','数字电路',856);
insert into course(cno,cname,tno) values('9-888','高等数学',831);
--score表(添加外键后要先填Student,course表中数据去满足外键约束)
insert into score(sno,cno,degree) values(103,'3-245',86);
insert into score(sno,cno,degree) values(105,'3-245',75);
insert into score(sno,cno,degree) values(109,'3-245',68);
insert into score(sno,cno,degree) values(103,'3-105',92);
insert into score(sno,cno,degree) values(105,'3-105',88);
insert into score(sno,cno,degree) values(109,'3-105',76);
insert into score(sno,cno,degree) values(101,'3-105',64);
insert into score(sno,cno,degree) values(107,'3-105',91);
insert into score(sno,cno,degree) values(108,'3-105',78);
insert into score(sno,cno,degree) values(101,'6-166',85);
insert into score(sno,cno,degree) values(107,'6-166',79);
insert into score(sno,cno,degree) values(108,'6-166',81);

常用操作语句

@ 连接数据库
$ sqlplus /nolog
SQL> connect / as sysdba

@ 创建表
create table t1(id int not null,name varchar(8) not null,tel int not null);

@ 增
insert into t1(id,name,tel) values ('1','linux','13812341234');

@ 改
update t1 set tel='15512345678' where tel='13812341234';

@清空表
truncate table t1;

@ 修改表名
rename t1 to tb1;

@ 增加字段
alter table tb1 add sex char(4);

@ 修改字段名
alter table tb1 rename column tel to tell;

@ 删除字段
alter table tb1 drop column sex;

@ 修改字段类型
alter table tb1 modify sex int;

常用管理语句

@ 连接数据库
$ sqlplus /nolog
SQL> connect / as sysdba

@ 查看当前登录的用户
select user from dual;
show user;

@ 查询所有表
dba_tables : 系统里所有的表的信息,需要DBA权限才能查询
all_tables : 当前用户有权限的表的信息(只要对某个表有任何权限,即可在此视图中看到表的相关信息)
user_tables: 当前用户名下的表的信息

@ 查看表空间文件位置
select * from dba_data_files;
select * from dba_data_files where tablespace_name='UFGOV';

@ 查看当前所用数据库
select instance_name from  V$instance;

@ 查看当前用户所有表
select table_name from user_tables;

@ 查询数据库表行数
select t.table_name,t.num_rows from user_tables t;

@ 查看表空间的名称及大小
SQL> SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size FROM dba_tablespaces t, dba_data_files d WHERE t.tablespace_name = d.tablespace_name GROUP BY t.tablespace_name;

@ 查看表空间物理文件的名称及大小
SELECT tablespace_name,file_id,file_name,round(bytes / (1024 * 1024), 0) total_space FROM dba_data_files ORDER BY tablespace_name;

@ 表空间是否为自动扩展
select tablespace_name,file_name,autoextensible from dba_data_files;

@ 开启自动扩展
alter database datafile '/home/oracle/oradata/ufgov/UFGOV.dbf' autoextend on;

@ 关闭自动扩展
alter database datafile '/home/oracle/oradata/ufgov/UFGOV.dbf' autoextend off;

@ 开启自动扩展,并限制文件最大值
alter database datafile '/home/oracle/oradata/ufgov/UFGOV.dbf' autoextend on NEXT 50M maxsize 10G;

@ 删除表空间
drop tablespace UFGOV including contents and datafiles cascade constraints;

@ 删除用户
drop user usrufgov cascade;

@ Oracle表空间大小及所剩空间大小
方法一:
select f.tablespace_name,
       a.total,
       u.used,
       f.free,
       round((u.used / a.total) * 100) "% USED",
       round((f.free / a.total) * 100) "% FREE"
  from (select tablespace_name, sum(bytes / (1024 * 1024)) total
          from dba_data_files
         group by tablespace_name) a,
       (select tablespace_name, round(sum(bytes / (1024 * 1024))) used
          from dba_extents
         group by tablespace_name) u,
       (select tablespace_name, round(sum(bytes / (1024 * 1024))) free
          from dba_free_space
         group by tablespace_name) f
 where a.tablespace_name = f.tablespace_name
   and a.tablespace_name = u.tablespace_name;

方法二:更快
select a.tablespace_name,
       a.bytes / 1024 / 1024 "Sum MB",
       (a.bytes - b.bytes) / 1024 / 1024 "used MB",
       b.bytes / 1024 / 1024 "free MB",
       round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "percent_used"
  from (select tablespace_name, sum(bytes) bytes
          from dba_data_files
         group by tablespace_name) a,
       (select tablespace_name, sum(bytes) bytes, max(bytes) largest
          from dba_free_space
         group by tablespace_name) b
 where a.tablespace_name = b.tablespace_name
 order by ((a.bytes - b.bytes) / a.bytes) desc;

@ 查看回滚段名称及大小
SELECT segment_name,tablespace_name,r.status,(initial_extent / 1024) initialextent,(next_extent / 1024) nextextent,max_extents,v.curext curextent FROM dba_rollback_segs r, v$rollstat v WHERE r.segment_id = v.usn(+) ORDER BY segment_name;

@ 查看控制文件
SELECT NAME FROM v$controlfile;

@ 查看日志文件
SELECT MEMBER FROM v$logfile;

@ 查看表空间的使用情况
SELECT SUM(bytes) / (1024 * 1024) AS free_space, tablespace_name
FROM dba_free_space
GROUP BY tablespace_name;
SELECT a.tablespace_name,
a.bytes total,
b.bytes used,
c.bytes free,
(b.bytes * 100) / a.bytes "% USED ",
(c.bytes * 100) / a.bytes "% FREE "
FROM sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free c
WHERE a.tablespace_name = b.tablespace_name
AND a.tablespace_name = c.tablespace_name;

@ 查看数据库库对象
SELECT owner, object_type, status, COUNT(*) count#
FROM all_objects
GROUP BY owner, object_type, status;

@ 查看数据库的版本 
SELECT version
FROM product_component_version
WHERE substr(product, 1, 6) = 'Oracle';

@ 查看数据库的创建日期和归档方式
SELECT created, log_mode, log_mode FROM v$database;

--1G=1024MB
--1M=1024KB
--1K=1024Bytes
--1M=11048576Bytes
--1G=1024*11048576Bytes=11313741824Bytes
SELECT a.tablespace_name "表空间名",
total "表空间大小",
free "表空间剩余大小",
(total - free) "表空间使用大小",
total / (1024 * 1024 * 1024) "表空间大小(G)",
free / (1024 * 1024 * 1024) "表空间剩余大小(G)",
(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;

@ 查看表占用表空间的大小,查看各表数据的行数
SELECT t.table_name, t.NUM_ROWS, s.BYTES, t.OWNER, t.TABLESPACE_NAME
  FROM dba_tables t, user_segments s
 where t.TABLE_NAME = s.segment_name
 ORDER BY 3 DESC;

@ 给UFGOV表空间再添加数据文件
ALTER TABLESPACE UFGOV ADD DATAFILE '/home/oracle/oradata/ufgov/UFGOV01.dbf' SIZE 2048M;

@ 删除某个数据文件
alter tablespace UFGOV drop datafile '/home/oracle/oradata/ufgov/UFGOV01.dbf';

@ 修改数据文件大小
alter database datafile '/home/oracle/oradata/ufgov/UFGOV01.dbf' RESIZE 10240M;

@ 移动数据文件,或者数据文件所在的磁盘损坏,需要将这些文件的副本移动到其他的磁盘,然后恢复。
  举例:移动 UFGOV.dbf
 --1.确定数据文件所在的表空间
     select tablespace_name from dba_data_files where fille_name='/home/oracle/oradata/ufgov/UFGOV.dbf';

 --2.使表空间脱机,确保数据文件的一致性,将表空间转变为offline的状态。
     alter tablespace UFGOV offline;

 --3.使用命令移动数据文件到指定的目标位置
     host move '/home/oracle/oradata/ufgov/UFGOV.dbf' '/data1/oracle/oradata/ufgov/UFGOV.dbf';

 --4.执行alter tablespace命令 --在物理上移动了数据之后,还必须执行alter tablespace命令对数据库文件进行逻辑修改
    alter tablespace UFGOV rename datafile '/home/oracle/oradata/ufgov/UFGOV.dbf' to '/data1/oracle/oradata/ufgov/UFGOV.dbf';

 --5.使表空间联机
    alter tablespace UFGOV online;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值