如何使用 SQL-Developer 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
问题描述
我整理了一份在 Fedora 33 Linux 上安装和启动 Oracle 数据库快捷版的综合指南.我不得不从众多来源拼凑起来,它奏效了.不仅是安装,还包括安装后机器重启时用监听器启动数据库,如何设置非系统数据库用户,以及如何添加连接.我希望本指南对遇到它的人有用.Fedora 33 Oracle DB XE 18c 和 SQLDeveloper 设置的工作指南很少.这是:
安装说明:
首先从可启动密钥安装 Fedora 33 Workstation Edition(要双启动,只需留下一个您希望操作系统驻留的空分区(建议在 Windows 10 中从磁盘管理中缩小空间)并在 Fedora 中选择自动分区"安装程序.
安装 Oracle Database 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
通过以 root 身份登录然后运行来配置数据库:
sudo su/etc/init.d/oracle-xe-18c
在提示符下,为 SYS
、SYSTEM
和 PDBADMIN
帐户指定相同的密码.不包含特殊字符,也不要在密码开头放置数字.
安装 Java JDK11:
sudo dnf -y install java-11-openjdk-devel java-11-openjdk-jmods java-11-openjdk-src
在家庭用户的.bashrc
底部添加以下几行:
# 用户特定的别名和函数export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))导出路径=$PATH:$JAVA_HOME/binexport CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar导出 ORACLE_BASE=/opt/oracle导出 ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE导出 ORACLE_SID=XE导出路径=$PATH:$ORACLE_HOME/bin导出 LD_LIBRARY_PATH=$ORACLE_HOME/lib
并使用源.bashrc
以 oracle 用户身份登录:
sudo su oracle
在oracle用户的.bashrc
末尾添加以下内容:
# 用户特定的别名和函数导出 ORACLE_BASE=/opt/oracle导出 ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE导出 ORACLE_SID=XE导出路径=$PATH:$ORACLE_HOME/bin导出 LD_LIBRARY_PATH=$ORACLE_HOME/lib
并输入source ~/.bashrc
退出并转到以下站点并下载sql-developer:https://www.oracle.com/tools/downloads/sqldev-downloads.html
安装 .rpm 并运行安装脚本:
sudo dnf -y install sqldeveloper-20.4.1.407.0006-20.4.1-407.0006.noarch.rpmcd/opt/sqldeveloper/./sqldeveloper.sh
对于 HiDPI 显示,将以下内容附加到 /opt/oracle-sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
:AddVMOption -Dsun.java2d.uiScale=2
如何添加非系统数据库用户(这样你就不用看系统表了):在终端类型中:sqlplus sys as sysdba
输入行:
<代码>SQL>更改会话设置_ORACLE_SCRIPT"=true;
创建一个您想要的任何名称的本地用户.输入用户的密码标识为"之后的下一行
<代码>SQL>在此处创建由密码标识的用户用户名
授予您的用户管理员权限:
<代码>SQL>在此处授予用户名的所有权限;
然后退出命令提示符:
<代码>SQL>退出;
现在您可以在 Oracle SQL Developer IDE 中连接到您的本地数据库.在系统 shell 菜单中搜索 sqldeveloper.它应该可以正常启动,现在您要添加到本地机器数据库的连接.在 IDE 窗口的左上角,您应该会看到一个名为Connections"的标签.带有绿色加号.单击加号,您将收到连接提示.在名称"下为您的本地数据库输入一个合适的名称.我称我的为LocalDatabase".命名数据库时,除了下划线外,避免使用空格或特殊字符.对于用户名"和密码"在 SQL Plus 命令提示符下输入您为非系统帐户创建的用户名和密码.勾选保存密码"盒子.将主机名 (localhost)、端口 (1521) 和 SID (xe) 保留为连接到本地数据库的默认值.在连接"窗口底部,单击测试".它应该说状态:成功.然后点击保存"按钮,您应该会在连接"窗口中看到您的连接添加到其中.点击连接"窗口将关闭,您将成功连接到本地计算机上的数据库.恭喜,现在您可以在自己的计算机上使用 Oracle SQL Plus!
重新启动您的机器并按照以下说明可靠地重新连接到您的数据库.
操作说明(安装后):
如果您已经完成安装步骤:首先要启动数据库服务.在终端的家庭用户帐户中,输入
sqlplus sys as sysdba
然后输入您在安装时分配的数据库密码.在 SQL 提示符下,输入
<代码>SQL>启动
等待数据库启动,然后退出
<代码>SQL>退出
然后以 oracle 用户身份登录:
sudo su oracle
然后运行:
lsnrctl start
然后是状态:lsnrctl 状态
退出家庭用户,然后打开 sqldeveloper 并成功连接到您本地安装的数据库!
就是这样,我希望有人觉得这有用!:)
I have put together a comprehensive guide to installing and starting Oracle Database Express Edition on Fedora 33 Linux. 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. 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.
Install Oracle Database 18c Express Edition:
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:
sudo su
/etc/init.d/oracle-xe-18c
At the prompt, specify the same password for the SYS
, SYSTEM
, and PDBADMIN
accounts. Include no special characters and do not place a number at the beginning of the password.
Install 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
:
# 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
Login as oracle user using:
sudo su oracle
Add the following to the end of oracle user's .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
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:
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
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
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. Search for sqldeveloper in the system shell menu. 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. 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". 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. Check the "Save Password" box. Keep the Hostname (localhost), Port (1521), and SID (xe) the default values to connect to your local database. At the bottom of the Connection window, click "Test" and it should say Status: Success. Then click the "Save" button and you should see your connection added among those in the Connections window. Click "Connect" and the window will close and you will be successfully connected to the database on your local machine. Congratulations, now you can use Oracle SQL Plus on your own computer!
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> startup
Wait for the database to start, then exit with
SQL> exit
then login as oracle user:
sudo su oracle
And run:
lsnrctl start
Then for the status:
lsnrctl status
Exit to home user then open sqldeveloper and connect successfully to your locally installed database!
That's it, I hope someone finds this useful! :)
这篇关于如何使用 SQL-Developer IDE 在 Fedora Linux 上安装和启动 Oracle Database Express Edition (XE) 18c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!