简体   繁体   English

如何使用 SQL 开发人员 IDE 在 Fedora Linux 上安装和启动 Oracle Database Express Edition (XE) 18c

[英]How to install and start Oracle Database Express Edition (XE) 18c on Fedora Linux with SQL-Developer IDE

I have put together a comprehensive guide to installing and starting Oracle Database Express Edition on Fedora 33 Linux.我整理了一份关于在 Fedora 33 Linux 上安装和启动 Oracle 数据库快捷版的综合指南。 I had to cobble this together from numerous sources, and it works.我不得不从众多来源拼凑起来,并且它有效。 It's not just the installation, it's also getting the database to start with the listener after installation when the machine is rebooted, how to setup a non-system database user, and how to add a connection.不只是安装,还包括安装后机器重启时用监听器启动数据库,如何设置非系统数据库用户,以及如何添加连接。 I hope this guide is useful to whoever comes across it.我希望本指南对遇到它的人有用。 There are precious few working guides for Fedora 33 Oracle DB XE 18c and SQLDeveloper setup. Fedora 33 Oracle DB XE 18c 和 SQLDeveloper 设置的工作指南很少。 Here it is:这里是:

INSTALLATION INSTRUCTIONS:安装说明:

First install Fedora 33 Workstation Edition from a bootable key (to dual-boot, just leave an empty partition you want the OS to reside (recommend shrink space from Disk Management in Windows 10) and select"Automatic Partitioning" in the Fedora installer.首先从可启动密钥安装 Fedora 33 Workstation Edition(要进行双启动,只需保留一个您希望操作系统驻留的空分区(建议从 Windows 10 的磁盘管理中缩小空间)并在 Fedora 安装程序中选择“自动分区”。

Install Oracle Database 18c Express Edition:安装 Oracle 数据库 18c 快捷版:

sudo dnf -y install http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm

sudo dnf -y install http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

dnf -y install libnsl

curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm -L https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

dnf -y install oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

curl -o oracle-database-xe-18c-1.0-1.x86_64.rpm -L https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm

sudo dnf -y install oracle-database-xe-18c-1.0-1.x86_64.rpm

Configure the database by logging in as root then running:通过以 root 身份登录然后运行来配置数据库:

sudo su
/etc/init.d/oracle-xe-18c

At the prompt, specify the same password for the SYS , SYSTEM , and PDBADMIN accounts.在提示符处,为SYSSYSTEMPDBADMIN帐户指定相同的密码。 Include no special characters and do not place a number at the beginning of the password.不包括特殊字符,并且不要在密码的开头放置数字。

Install Java JDK11:安装Java JDK11:

sudo dnf -y install java-11-openjdk-devel java-11-openjdk-jmods java-11-openjdk-src

Add the following lines to the bottom of the home user's .bashrc :将以下行添加到家庭用户的.bashrc底部:

# User specific aliases and functions
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE
export ORACLE_SID=XE
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

and use source.bashrc并使用source.bashrc

Login as oracle user using:使用 oracle 用户登录:

sudo su oracle

Add the following to the end of oracle user's .bashrc :在 oracle 用户的.bashrc末尾添加以下内容:

# User specific aliases and functions
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE
export ORACLE_SID=XE
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

and type source ~/.bashrc并输入source ~/.bashrc

Exit and go to the following site and download sql-developer: https://www.oracle.com/tools/downloads/sqldev-downloads.html Exit and go to the following site and download sql-developer: https://www.oracle.com/tools/downloads/sqldev-downloads.html

Install the.rpm and run the setup script:安装 .rpm 并运行安装脚本:

sudo dnf -y install sqldeveloper-20.4.1.407.0006-20.4.1-407.0006.noarch.rpm
cd /opt/sqldeveloper/
./sqldeveloper.sh

For HiDPI displays, append to /opt/oracle-sqldeveloper/sqldeveloper/bin/sqldeveloper.conf the following: AddVMOption -Dsun.java2d.uiScale=2对于 HiDPI 显示器,append 到/opt/oracle-sqldeveloper/sqldeveloper/bin/sqldeveloper.conf如下: AddVMOption -Dsun.java2d.uiScale=2

How to add a non-system database user (so you don't have to see system tables): In a terminal type: sqlplus sys as sysdba如何添加非系统数据库用户(因此您不必查看系统表):在终端类型中: sqlplus sys as sysdba

Enter the lines:输入以下行:

SQL> alter session set "_ORACLE_SCRIPT"=true;

Create a local user called whatever you want.创建一个本地用户,无论你想要什么。 Type the password for the user in the following line after "identified by"在“识别者”之后的以下行中键入用户的密码

SQL> create user usernamehere identified by passwordhere;

Grant your user admin privileges:授予您的用户管理员权限:

SQL> grant all privileges to usernamehere;

Then exit the command prompt:然后退出命令提示符:

SQL> exit;

Now you can connect to your local database in the Oracle SQL Developer IDE.现在您可以连接到 Oracle SQL Developer IDE 中的本地数据库。 Search for sqldeveloper in the system shell menu.在系统 shell 菜单中搜索 sqldeveloper。 It should start up fine, now you want to add a connection to your local machine database.它应该可以正常启动,现在您要添加到本地计算机数据库的连接。 On the top left side of the IDE window, you should see a label called "Connections" with a green plus sign.在 IDE window 的左上角,您应该看到一个名为“Connections”的 label,带有一个绿色加号。 Click on the plus sign and you will get a connection prompt.单击加号,您将收到连接提示。 Under "Name" enter a suitable name for your local database.在“名称”下,为您的本地数据库输入一个合适的名称。 I called mine "LocalDatabase".我称我为“LocalDatabase”。 Avoid using spaces or special characters besides the underscore when naming your database.命名数据库时,避免使用下划线以外的空格或特殊字符。 For "Username" and "Password" enter the username and password you created for your non-system account in the SQL Plus command prompt.对于“用户名”和“密码”,输入您在 SQL Plus 命令提示符中为非系统帐户创建的用户名和密码。 Check the "Save Password" box.选中“保存密码”框。 Keep the Hostname (localhost), Port (1521), and SID (xe) the default values to connect to your local database.将主机名 (localhost)、端口 (1521) 和 SID (xe) 保留为默认值以连接到本地数据库。 At the bottom of the Connection window, click "Test" and it should say Status: Success.在连接 window 的底部,单击“测试”,它应该显示状态:成功。 Then click the "Save" button and you should see your connection added among those in the Connections window.然后单击“保存”按钮,您应该会看到您的连接已添加到 Connections window 中。 Click "Connect" and the window will close and you will be successfully connected to the database on your local machine.单击“连接”,window 将关闭,您将成功连接到本地计算机上的数据库。 Congratulations, now you can use Oracle SQL Plus on your own computer!恭喜,现在您可以在自己的电脑上使用 Oracle SQL Plus!

Restart your machine and follow the instructions at the below for reliably reconnecting to your database.重新启动您的计算机并按照以下说明可靠地重新连接到您的数据库。

OPERATION INSTRUCTIONS (AFTER INSTALLATION):操作说明(安装后):

If you have done installation steps already: First you want to start the database service.如果您已经完成安装步骤:首先您要启动数据库服务。 From your home user account in a terminal, type从终端中的家庭用户帐户中,键入

sqlplus sys as sysdba

then enter your database password you assigned on installation.然后输入您在安装时分配的数据库密码。 At the SQL prompt, enter在 SQL 提示符下,输入

SQL> startup

Wait for the database to start, then exit with等待数据库启动,然后退出

SQL> exit

then login as oracle user:然后以 oracle 用户身份登录:

sudo su oracle

And run:并运行:

lsnrctl start

Then for the status: lsnrctl status然后对于状态: lsnrctl status

Exit to home user then open sqldeveloper and connect successfully to your locally installed database!退出到家庭用户,然后打开 sqldeveloper 并成功连接到本地安装的数据库!

That's it, I hope someone finds this useful: :)就是这样,我希望有人觉得这很有用::)

You cant create a user on the main db as you have it, you have to go into the xepdba1 in order to create a user / schema and then connect there to create tables and insert rows.您无法在主数据库上创建用户,您必须将 go 插入 xepdba1 以创建用户/模式,然后连接到那里以创建表并插入行。

I had to install it twice because I had my ENV variables configured for previous software installed caused a mess.我不得不安装它两次,因为我为以前安装的软件配置了 ENV 变量导致一团糟。

Removed it and installed again, with correct ORACLE_HOME defined.删除它并再次安装,并定义了正确的 ORACLE_HOME。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM