- 创建数据库目录
mkdir -p /home/oracle/Documents/db
- 创建用户
create user cheng identified by 123456;
- 授权
grant connect,resource to cheng;
grant create any sequence to cheng;
grant create any table to cheng;
grant delete any table to cheng;
grant insert any table to cheng;
grant select any table to cheng;
grant unlimited tablespace to cheng;
grant execute any procedure to cheng;
grant update any table to cheng;
grant create any view to cheng;
- 建立表空间
create tablespace testspace
datafile '/home/oracle/Documents/db/TESTSPACE.dbf'
size 1000M
autoextend on next 5M maxsize 3000M;
- 授予用户使用表空间的权限:
alter user cheng quota unlimited on testspace;
附Oracle最高效分页和插入后返回自增长主键值:
SELECT *
FROM
(
SELECT
ROWNUM AS rn,
a.*
FROM
(SELECT *
FROM BOOK_INFO t
ORDER BY t.B_ID) a
WHERE
ROWNUM <= #{end}
) b
WHERE
b.rn >= #{begin}
<selectKey resultType="java.math.BigDecimal" order="BEFORE" keyProperty="bId">
SELECT BOOK_SEQ.Nextval as B_ID from DUAL
</selectKey>