赞
踩
oracle库表的使用是每个开发人员需要掌握的技能。
版本:19.2.0。
sqlplus / as sysdba
create tablespace student datafile '/u01/app/oracle/oradata/ORCL/student2.dbf' size 1024M;
select * from v$tablespace;
SELECT tablespace_name "表空间名称", file_name "数据文件名称",bytes/1024/1024 "文件大小(M)" FROM dba_data_files;
alter tablespace student add datafile '/u01/app/oracle/oradata/ORCL/student1.dbf';
alter tablespace student drop datafile '/u01/app/oracle/oradata/ORCL/student1.dbf';
drop tablespace student including contents and datafiles;
公用用户名以C##开头
alter session set "_ORACLE_SCRIPT"=true;
create user student identified by student default tablespace student account unlock;
show user
select * from all_users;
alter user student identified by student;
drop user student;
grant connect,resource,dba to student;
sqlplus student/student@orcl
or
sqlplus student/student@localhost:1521/orcl
如果报没有监听器错误(无监听程序),然后sqlplus连接没有问题,可尝试修改listener.ora
文件
# listener.ora Network Configuration File: /u01/app/oracle/product/19.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.208)(PORT = 1521))
)
)
mysql导出建表语句,很多地方oracle不兼容,需要调整(emo)
CREATE TABLE t_student_info (
id varchar(255) NOT NULL,
name varchar(50) NOT NULL,
age number NULL,
birthday date NULL,
nation varchar(30) NULL,
id_type varchar(20) NOT NULL,
id_number varchar(20) NOT NULL,
tel number NULL,
admission_time date NULL,
address varchar(255) NULL,
faculty varchar(50) NULL,
major varchar(255) NULL,
class number NULL,
instructor varchar(50) NULL,
registered char(1) NULL
)
drop table t_student_info;
alter session set "_ORACLE_SCRIPT"=true;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。