Oracle23免费版简易安装攻略

installation-guide

1 安装

root用户下

wget https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-1.el8.x86_64.rpm
wget https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23c-1.0-1.el8.x86_64.rpm

dnf -y localinstall oracle-database-preinstall-23c-1.0-1.el8.x86_64.rpm
dnf -y localinstall oracle-database-free-23c-1.0-1.el8.x86_64.rpm

2 配置建库

交互式安装

/etc/init.d/oracle-free-23c configure

结果需要记录下,库名、端口都在这里

Connect to Oracle Database using one of the connect strings:
     Pluggable database: VM-130-23-tencentos:1539/FREEPDB1
     Multitenant container database: VM-130-23-tencentos:1539

如果使用slient安装需要改配置文件/etc/sysconfig/oracle-free--23c.confd

然后再执行/etc/init.d/oracle-free-23c configure

/opt/oracle Oracle base. This is the root of the Oracle Database Free directory tree.
/opt/oracle/product/23c/dbhomeFree Oracle home. This home is where the Oracle Database Free is installed. It contains the directories of the Oracle Database Free executables and network files.
/opt/oracle/oradata/FREE Database files.
/opt/oracle/diag subdirectories Diagnostic logs. The database alert log is /opt/oracle/diag/rdbms/free/FREE/trace/alert_FREE.log
/opt/oracle/cfgtoollogs/dbca/FREE Database creation logs. The FREE.log file contains the results of the database creation script execution.
/etc/sysconfig/oracle-free-23c.conf Configuration default parameters.
/etc/init.d/oracle-free-23c Configuration and services script.

3 环境变量

切到oracle用户下或root用户下配置

export ORACLE_SID=FREE 
export ORAENV_ASK=NO 
. /opt/oracle/product/23c/dbhomeFree/bin/oraenv

4 启停

-- oracle用户 连sys
sqlplus / as sysdba

-- root用户 连sys
sqlplus sys@VM-130-23-tencentos:1539/FREEPDB1 as sysdba

-- 其他用户执行
sqlplus system@VM-130-23-tencentos:1539/FREEPDB1

-- 停 需要连sys
SHUTDOWN IMMEDIATE

-- 启 需要连sys
STARTUP
ALTER PLUGGABLE DATABASE ALL OPEN;

native编译的一些探索(忽略)

oracle服务进程的/proc/xxxx/fd

0 -> /dev/null
1 -> /dev/null
16 -> 'socket:[1403776518]'
2 -> /dev/null
256 -> /opt/oracle/oradata/FREE/FREEPDB1/undotbs01.dbf
257 -> /opt/oracle/oradata/FREE/FREEPDB1/system01.dbf
3 -> /dev/null
4 -> /opt/oracle/product/23c/dbhomeFree/rdbms/mesg/oraus.msb
5 -> /proc/553076/fd
6 -> 'anon_inode:[eventpoll]'
7 -> /proc/553076/schedstat

创建存储过程

sql 复制代码
CREATE OR REPLACE PROCEDURE PC123 AS
i simple_integer := 0;
v_number simple_integer := 0;
BEGIN
LOOP
v_number := i + 1000;
i := i + 1;
exit when i > 1000000000;
END LOOP;
END;
/

写了257系统表。

sh 复制代码
pread64(7, "13536596324 333903 152\n", 80, 0) = 23
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=523637}, ru_stime={tv_sec=0, tv_usec=12997}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=523797}, ru_stime={tv_sec=0, tv_usec=12997}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=524096}, ru_stime={tv_sec=0, tv_usec=12997}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526023}, ru_stime={tv_sec=0, tv_usec=12997}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526218}, ru_stime={tv_sec=0, tv_usec=12997}, ...}) = 0
pread64(7, "13539241765 333903 164\n", 80, 0) = 23
openat(AT_FDCWD, "/opt/oracle/oradata/FREE/FREEPDB1/system01.dbf", O_RDWR|O_DSYNC) = 8
fcntl(8, F_SETFD, FD_CLOEXEC)           = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=64*1024, rlim_max=64*1024}) = 0
fcntl(8, F_DUPFD, 256)                  = 257
fcntl(257, F_SETFD, FD_CLOEXEC)         = 0
close(8)                                = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526423}, ru_stime={tv_sec=0, tv_usec=12997}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526423}, ru_stime={tv_sec=0, tv_usec=13345}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526423}, ru_stime={tv_sec=0, tv_usec=13418}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526423}, ru_stime={tv_sec=0, tv_usec=13501}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=526423}, ru_stime={tv_sec=0, tv_usec=13592}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=527005}, ru_stime={tv_sec=0, tv_usec=13996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=527076}, ru_stime={tv_sec=0, tv_usec=13996}, ...}) = 0
semop(27, [{sem_num=26, sem_op=1, sem_flg=0}], 1) = 0
pread64(7, "13541568039 333903 194\n", 80, 0) = 23
semtimedop(27, [{sem_num=55, sem_op=-1, sem_flg=0}], 1, {tv_sec=0, tv_nsec=100000000}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=527678}, ru_stime={tv_sec=0, tv_usec=13996}, ...}) = 0
pread64(7, "13541702360 333903 201\n", 80, 0) = 23
write(16, "\0\0\0\306\6\0\0\0 \0\10\6\0\212\344 \0\0\0\0\0\4\0\0\0\0\0\0\0\0\0\0"..., 198) = 198

alter session set plsql_code_type = native;

只能看到系统调度,应该就是改了个内存状态。

sh 复制代码
pread64(7, "13541846178 333903 208\n", 80, 0) = 23
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=527889}, ru_stime={tv_sec=0, tv_usec=13996}, ...}) = 0
write(16, "\0\0\0\306\6\0\0\0 \0\10\6\0\267\344 \0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0"..., 198) = 198

native编译alter procedure test_speed_14 compile;

能看出来的就是申请了共享内存,应该是编译到共享内存中了,这样别的会话也能用。

sh 复制代码
pread64(7, "13542161098 333903 217\n", 80, 0) = 23
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=527889}, ru_stime={tv_sec=0, tv_usec=14427}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=528341}, ru_stime={tv_sec=0, tv_usec=14995}, ...}) = 0
statfs("/dev/shm/", {f_type=TMPFS_MAGIC, f_bsize=4096, f_blocks=8197749, f_bfree=8192566, f_bavail=8192566, f_files=8197749, f_ffree=8197708, f_fsid={val=[0, 0]}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_NOSUID|ST_NODEV}) = 0
futex(0x7fe8268ea3b0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
openat(AT_FDCWD, "/dev/shm/PESLD_FREE_148021_1081aa9100000000", O_RDWR|O_CREAT|O_TRUNC|O_NOFOLLOW|O_CLOEXEC, 0700) = 8
ftruncate(8, 712)                       = 0
write(8, "\10", 1)                      = 1
mmap(NULL, 712, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED, 8, 0) = 0x7fe828ecc000
close(8)                                = 0
munmap(0x7fe828ecc000, 712)             = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=530444}, ru_stime={tv_sec=0, tv_usec=15995}, ...}) = 0
pread64(7, "13546923666 333903 241\n", 80, 0) = 23
mmap(0x7fe8228bb000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe8228bb000
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=531359}, ru_stime={tv_sec=0, tv_usec=15996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=531479}, ru_stime={tv_sec=0, tv_usec=15997}, ...}) = 0
mmap(0x7fe8228cb000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe8228cb000
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=531479}, ru_stime={tv_sec=0, tv_usec=16958}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=531540}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
pread64(7, "13549514915 333903 255\n", 80, 0) = 23
mmap(0x7fe8228db000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe8228db000
mmap(0x7fe8228eb000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe8228eb000
openat(AT_FDCWD, "/dev/shm/PESLD_FREE_148021_1081aa9100000000", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 8
mmap(NULL, 712, PROT_READ|PROT_EXEC, MAP_PRIVATE, 8, 0) = 0x7fe828ecc000
close(8)                                = 0
mmap(0x7fe8226fb000, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe8226fb000
mmap(0x7fe82271b000, 196608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe82271b000
mmap(0x7fe82274b000, 196608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe82274b000
munmap(0x7fe828ecc000, 712)             = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=533166}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=534144}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=535124}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=535247}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
semop(27, [{sem_num=26, sem_op=1, sem_flg=0}], 1) = 0
pread64(7, "13552441594 333903 285\n", 80, 0) = 23
semtimedop(27, [{sem_num=55, sem_op=-1, sem_flg=0}], 1, {tv_sec=0, tv_nsec=100000000}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=535518}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
pread64(7, "13552538646 333903 292\n", 80, 0) = 23
write(16, "\0\0\0\306\6\0\0\0 \0\10\6\0\341\344 \0\0\0\0\0\5\0\0\0\0\0\0\0\0\0\0"..., 198) = 198

运行exec PC123;

运行时不需要什么系统调用,所以只能看到调度

sh 复制代码
pread64(7, "13552679150 333903 299\n", 80, 0) = 23
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=535717}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=13, tv_usec=536940}, ru_stime={tv_sec=0, tv_usec=16996}, ...}) = 0
openat(AT_FDCWD, "/dev/shm/PESLD_FREE_148021_1081aa9100000000", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 8
mmap(NULL, 712, PROT_READ|PROT_EXEC, MAP_PRIVATE, 8, 0) = 0x7fe828ecc000
close(8)                                = 0
pread64(7, "13628475958 342660 312\n", 80, 0) = 23
pread64(7, "13729415638 342660 314\n", 80, 0) = 23
pread64(7, "13830271711 342660 316\n", 80, 0) = 23
pread64(7, "13931201975 342660 318\n", 80, 0) = 23
pread64(7, "14032064432 342660 320\n", 80, 0) = 23
pread64(7, "14132997050 348150 323\n", 80, 0) = 23
pread64(7, "14233856420 360664 326\n", 80, 0) = 23
pread64(7, "14334756366 360664 328\n", 80, 0) = 23
pread64(7, "14435619012 360664 330\n", 80, 0) = 23
pread64(7, "14536513829 360664 332\n", 80, 0) = 23
pread64(7, "14637402884 360664 334\n", 80, 0) = 23
pread64(7, "14738330462 360664 336\n", 80, 0) = 23
pread64(7, "14839235880 360664 338\n", 80, 0) = 23
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=14, tv_usec=870068}, ru_stime={tv_sec=0, tv_usec=17996}, ...}) = 0
getrusage(RUSAGE_THREAD, {ru_utime={tv_sec=14, tv_usec=898632}, ru_stime={tv_sec=0, tv_usec=17997}, ...}) = 0
pread64(7, "14916731193 360664 344\n", 80, 0) = 23
mmap(0x7fe82273b000, 262144, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0x231000) = 0x7fe82273b000
write(16, "\0\0\0\306\6\0\0\0 \0\10\6\0\260\350 \0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0"..., 198) = 198
相关推荐
百度智能云技术站6 小时前
广告投放系统成本降低 70%+,基于 Redis 容量型数据库 PegaDB 的方案设计和业务实践
数据库·redis·oracle
梦想平凡8 小时前
PHP 微信棋牌开发全解析:高级教程
android·数据库·oracle
夏木~10 小时前
Oracle 中什么情况下 可以使用 EXISTS 替代 IN 提高查询效率
数据库·oracle
吴冰_hogan11 小时前
MySQL InnoDB 存储引擎 Redo Log(重做日志)详解
数据库·oracle
CodeCraft Studio11 小时前
【实用技能】如何在 SQL Server 中处理 Null 或空值?
数据库·oracle·sqlserver
武汉联从信息11 小时前
浅谈ORACLE中间件SOA BPM,IDM,OID,UCM,WebcenterPortal服务器如何做迁移切换
oracle
Elastic 中国社区官方博客12 小时前
Elasticsearch:什么是查询语言?
大数据·数据库·elasticsearch·搜索引擎·oracle
夜光小兔纸13 小时前
oracle dblink 的创建及使用
数据库·oracle
Smile丶凉轩13 小时前
MySQL库的操作
数据库·mysql·oracle
p@nd@15 小时前
Oracle筑基篇-调度算法-LRU的引入
数据库·oracle·操作系统·lru