Steps to rebuild Zhiyuan OA system

Article Directory

The original OA server is broken. Migrating the OA system to another server is simply to rebuild the system.

1. Install the operating system

Insert picture description here


    Set the host name to OA, set the IP and gateway, and DNS to 114.114.114.114.

Insert picture description here


    The partition can be simply divided into the root partition and the swap partition, and you can install it on Desktop. It is recommended not to check the Java platform when installing the software.

Insert picture description here


    Turn off selinux and firewall, and set it not to start after booting.

2. Install ORACLE database

(1) Upload and use CentOS6.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

Install epel

# yum install epel-release -y

Create a new /home/tools folder and upload the following files to the folder:
    UFSeeyon.tar.gz (label the original application into a tar.gz package)
    oradata_exp_2021xxxx.dmp.gz (database backup file)
    linux.x64_11gR2_database_1of2.zip (Oracle installation file)
    linux.x64_11gR2_database_2of2.zip (oracle installation file)
    jdk-7u51-linux-x64.rpm
    (2) Unzip linux.x64_11gR2_database_1of2.zip and linux.x64_11gR2_database_2of2.zip, a database directory appears.

# unzip linux.x64_11gR2_database_1of2.zip
# unzip linux.x64_11gR2_database_2of2.zip

(3) yum installs the following software packages

yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install libXp* -y
yum install -y glibc-kernheaders
yum install -y unixODBC*

Check whether the lib is installed:

[[email protected] ~]# rpm -q --queryformat %-{name}-%{version}-%{release}-%{arch}"\n" \ compat-libstdc++-33 glibc-kernheaders glibc-headers libaio libgcc glibc-devel xorg-x11-deprecated-libs

(4) Install jdk-7u51-linux-x64.rpm

# rpm -ivh jdk-7u51-linux-x64.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...

After the installation is complete, the /usr/java folder appears.

(5) Adjust the kernel parameters and user limits
    . Copy the original system /etc/sysctl.conf and /etc/security/limits.conf to the new system. At the same time, /etc/hosts added:

127.0.0.1    OA

Create new users and groups

# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle

Replace the file in the same location with the /home/oracle/.bash_profile of the original system.
    Create the /u01 folder:

# mkdir /u01
# chown oracle:oinstall /u01/

After the preparation process is over, it is recommended to restart the host.

(6) Log in to the host as oracle and start Oracle's runInstaller. Start to install oracle.

Insert picture description here


    Remove the I wish to receive security updates via My Oracle Support option, click Next to

Insert picture description here


    select Install database software only, click Next to

Insert picture description here


    select Single instance database installation, click Next

Insert picture description here


    , select English, Simplified Chinese in Available Languages, and click> in the middle of the two boxes. Add the selected language to the Selected Languages ​​on the right, and then click Next.

Insert picture description here


    According to the actual situation, select the enterprise version and

Insert picture description here


    fill in the Oracle software path and base path. The

Insert picture description here


    installation log directory can be

Insert picture description here


    selected by default, and the dba group can be selected by default .

Insert picture description here


    Because the CentOS version is higher, the higher version lib package is not recognized during 11g check. Check Ignore All.

Insert picture description here


    Continue to install and

Insert picture description here


    wait for a while and

Insert picture description here


    click ok, continue to

Insert picture description here


    click close to end.

Insert picture description here

3. Configure database monitoring and instance

(1) Enter netca on the command line to configure database monitoring.

Insert picture description here


    Keep clicking Next and

Insert picture description here


    click Finish to end

Insert picture description here


    (2) Enter dbca on the command line to start configuring the database instance,

Insert picture description here


    click Next,

Insert picture description here


    select Custom Database, and

Insert picture description here


    enter the instance name v3x in the Global Database Name box. The SID box is automatically consistent with the Global Database Name box. Click Next

Insert picture description here


    to continue using the default value. Click Next

Insert picture description here


    to set passwords for SYS, SYSTEM, DBSNMP and SYSMAN users. After

Insert picture description here


    creating the folder /u01/app/oracle/oradata as oracle, select the folder, put all database files in the folder and

Insert picture description here


    keep the default values, click Next

Insert picture description here


    Keep the default value, click Next, the

Insert picture description here


    memory size can be configured flexibly according to the hardware situation, or you can keep the default value.

Insert picture description here


    Character set selection ZHS16GBK (choose according to the original application environment, we use the old version, the newer version is the first item Use the default)

Insert picture description here


    Check Generate Database Creation Scripts

Insert picture description here


    all the way to confirm the default configuration, use root to create the /etc/oratab file And grant 777 permissions.

Insert picture description here
# touch /etc/oratab
# chmod 777 /etc/oratab

Click ok to continue the installation.
    The entire installation process needs to wait for a long period of time to

Insert picture description here


    complete the installation, click Exit to exit.

Insert picture description here


    Finally, confirm that the /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora file has been generated. If the file is not generated, use the netca command to generate it.

4. Configure database permissions

(1) Confirm that the database is normal

Insert picture description here


    (2) Log in to the database command line to set the system

$ sqlplus "/ as sysdba"
SQL> alter system set deferred_segment_creation=false scope=spfile;
SQL> alter system set aq_tm_processes=1 scope=both;
SQL> ALTER SYSTEM SET undo_retention=10800 SCOPE=BOTH;

Create table space

SQL> create smallfile tablespace "V3XSPACE" 
    datafile '/u01/app/oracle/oradata/v3x/V3XFILE.DBF' size 20480m
    autoextend on next 10240m maxsize unlimited 
    logging extent management local segment space management auto;

Create an account and grant permissions

SQL> CREATE USER V3XUSER PROFILE DEFAULT IDENTIFIED 
    BY ****** DEFAULT TABLESPACE V3XSPACE TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK ;
SQL> GRANT CREATE VIEW,ALTER SESSION,CONNECT,RESOURCE,UNLIMITED TABLESPACE TO
    V3XUSER;
SQL> grant create session to v3xuser;
SQL> grant create table to v3xuser;
SQL> grant create sequence to v3xuser;
SQL> grant sysdba to v3xuser;
SQL> grant imp_full_database to v3xuser;

Login test:

$ sqlplus v3xuser

5. Import data

Please flexibly formulate a recovery plan based on the actual situation. My steps do not have much in common.
    (1) The command line executes the table creation statement.
    Create the BUL_TEMPLATE table:

    CREATE TABLE "V3XUSER"."BUL_TEMPLATE" 
   (	"ID" NUMBER(19,0) NOT NULL ENABLE, 
	"TEMPLATE_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE, 
	"USEDFLAG" NUMBER(1,0) DEFAULT 1 NOT NULL ENABLE, 
	"DESCRIPTION" CLOB, 
	"TEMPLATE_FORMAT" VARCHAR2(50 BYTE) NOT NULL ENABLE, 
	"CONTENT" CLOB, 
	"CREATE_USER" NUMBER(19,0) NOT NULL ENABLE, 
	"CREATE_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
	"UPDATE_DATE" TIMESTAMP (6), 
	"UPDATE_USER" NUMBER(19,0), 
	"ACCOUNTID" NUMBER(19,0) NOT NULL ENABLE, 
	"EXT1" VARCHAR2(50 BYTE), 
	"EXT2" VARCHAR2(50 BYTE), 
	 CONSTRAINT "PK_BUL_2" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "V3XSPACE"  ENABLE
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "V3XSPACE" 
 LOB ("DESCRIPTION") STORE AS BASICFILE (
  TABLESPACE "V3XSPACE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
  NOCACHE LOGGING ) 
 LOB ("CONTENT") STORE AS BASICFILE (
  TABLESPACE "V3XSPACE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
  NOCACHE LOGGING ) ;

Create the NEWS_TEMPLATE table:

    CREATE TABLE "V3XUSER"."NEWS_TEMPLATE" 
   (	"ID" NUMBER(19,0) NOT NULL ENABLE, 
	"TEMPLATE_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE, 
	"USEDFLAG" NUMBER(1,0) DEFAULT 1 NOT NULL ENABLE, 
	"DESCRIPTION" CLOB, 
	"TEMPLATE_FORMAT" VARCHAR2(50 BYTE) NOT NULL ENABLE, 
	"CONTENT" CLOB, 
	"CREATE_USER" NUMBER(19,0) NOT NULL ENABLE, 
	"CREATE_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
	"UPDATE_DATE" TIMESTAMP (6), 
	"UPDATE_USER" NUMBER(19,0), 
	"ACCOUNTID" NUMBER(19,0) NOT NULL ENABLE, 
	"EXT1" VARCHAR2(50 BYTE), 
	"EXT2" VARCHAR2(50 BYTE), 
	 CONSTRAINT "PK_NEWS_2" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "V3XSPACE"  ENABLE
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "V3XSPACE" 
 LOB ("DESCRIPTION") STORE AS BASICFILE (
  TABLESPACE "V3XSPACE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
  NOCACHE LOGGING ) 
 LOB ("CONTENT") STORE AS BASICFILE (
  TABLESPACE "V3XSPACE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION 
  NOCACHE LOGGING ) ;

(2) Unzip and import the backup file

# gunzip oradata_exp_2021xxxx.dmp.gz

Import the oradata_exp_2021xxxx.dmp file:

$ imp v3xuser/******@v3x file=oradata_exp_2021xxxx.dmp full=y

If an error occurs when importing the PROCESS_RUNNING table in this step:

. . importing table              "PROCESS_RUNNING"
IMP-00064: Definition of LOB was truncated by export
IMP-00028: partial import of previous table rolled back: xxxxxx rows rolled back

This is because there is a problem when executing exp to back up the database. It is best to rebuild the table PROCESS_RUNNING, import data and constraints according to the previous backup complete data;
    (4) Because the oradata_exp_2021xxxx.dmp.gz here is only the data of the v3x instance, and Incomplete, so I created a directory and added the entire database data expdat.dmp that was backed up before.

SQL> create or replace directory dirdmp as '/u01/app/oracle/admin/v3x/dpdump';   
SQL> select * from dba_directories;

Put expdat.dmp into the /u01/app/oracle/admin/v3x/dpdump folder, and import it additionally:

impdp v3xuser/****** table_exists_action=append DIRECTORY=dirdmp DUMPFILE=expdat.dmp FULL=y;

6. Start the application

(1) Unzip the file UFSeeyon.tar.gz, and move the file to /usr/local, modify the user authority to root (very important)
chown -R root:root /usr/local/UFSeeyon
    (2) Contact Zhiyuan , Update and replace the dongle key.
    (3) Start the application as root.

7. Problems and solutions

An error was reported when importing data:

IMP-00037: Character set marker unknown

The shell query character set is AMERICAN_AMERICA.AL32UTF8, and an error is reported when it is changed to ZHS16GBK

cat jzdjxx.dmp |od -x|head -1|awk '{print $2 $3}'|cut -c 3-6

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
--------------------------------------------------------------------------------
AMERICAN_AMERICA.AL32UTF8

SQL> alter database character set ZHS16GBK;
alter database character set ZHS16GBK
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set

Solution:

sqlplus /as sysdba
>shutdown immediate;  停止数据库
>startup mount; 把database重启到可更改状态 装载数据库,打开控制文件
>ALTER SESSION SET SQL_TRACE=TRUE;
>ALTER SYSTEM ENABLE RESTRICTED SESSION;
>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
>ALTER SYSTEM SET AQ_TM_PROCESSES=0;
>ALTER DATABASE OPEN;
>alter database character set ZHS16GBK;

ORA-12712: new character set must be a superset of old character set
RROR at line 1:
结果报错,提示新字符集必须是老字符集的超集。
于是强制转换
>ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
>shutdown immediate; 停止数据库
>startup 启动数据库