上一片中介绍了安装instantclient +plsql取代庞大客户端的安装,这里说下plsql的基本操作

plsql操作界面图:

1、复制表

语句:create table IGIS_COPY as select * from IGIS_LOCATION

2、查询前5行数据

select * from IGIS_LOCATION where rownum < 6

注意:与sql server的top 5 不同,前5行数据只能使用where rownum < 6

导出查询出来的数据。注意是.sql文件

下面是用txt打开上面导出的.sql文件,其原理是是对数据库进行insert

下面的数据表是

IGIS_LOCATION_COPY,是我将上面的
IGIS_LOCATION备份了一份,进行操作
prompt Importing table IGIS_LOCATION_COPY...
set feedback off
set define off
insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('001FF92FABE165', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('004999010640000', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('012963007793321', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013437006991011', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013789000795180', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); prompt Done.

3、导出整个表

右击表,点导出数据(或者单击工具--导出表)

选择第二个“SQL插入”,注意要选上:创建表,否者导出的.sql文件没有表结构,无法使用下一步中的“导入表”方法导入。

导出的.sql文件

prompt PL/SQL Developer import file
prompt Created on 2017年5月3日 by Administrator
set feedback off
set define off
prompt Creating IGIS_LOCATION_COPY...
create table IGIS_LOCATION_COPY
(
devicecode VARCHAR2(50) not null,
type VARCHAR2(10) not null,
longitude NUMBER(10,2) not null,
latitude NUMBER(10,2) not null,
datetime DATE not null
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
); prompt Disabling triggers for IGIS_LOCATION_COPY...
alter table IGIS_LOCATION_COPY disable all triggers;
prompt Deleting IGIS_LOCATION_COPY...
delete from IGIS_LOCATION_COPY;
commit;
prompt Loading IGIS_LOCATION_COPY...
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('001FF92FABE165', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('004999010640000', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('012963007793321', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('013437006991011', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('013789000795180', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('014583569411', 'car', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('049955', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('050846', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('050853', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('050859', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
commit;
prompt 10 records loaded
prompt Enabling triggers for IGIS_LOCATION_COPY...
alter table IGIS_LOCATION_COPY enable all triggers;
set feedback on
set define on
prompt Done.

4、导入整张表

单击 “工具”--“导入表”

SQL*Plus就是上一篇博文中介绍的下载了sqlplus,如果安装的时候没下载,参考上篇

http://www.cnblogs.com/lelehellow/p/6801800.html

5、导出表结构

单击 “工具”--“导出用户对象”

记得选中表

使用上一步中的“导入表”方法来导入这个.sql文件可以导入一张空表,表结构还是跟这张表一样的。

打开导出的用户对象 .sql文件,发现其实就是导出了创建表的sql语句。

----------------------------------------------------
-- Export file for user SYSTEM --
-- Created by Administrator on 2017-5-3, 13:09:02 --
---------------------------------------------------- set define off
spool guanxi.log prompt
prompt Creating table IGIS_LOCATION_COPY
prompt =================================
prompt
create table SYSTEM.IGIS_LOCATION_COPY
(
devicecode VARCHAR2(50) not null,
type VARCHAR2(10) not null,
longitude NUMBER(10,2) not null,
latitude NUMBER(10,2) not null,
datetime DATE not null
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
); spool off

6、使用“导入表”功能来导入第二步中导出的前5行数据

使用“导入表”功能来导入第二步中导出的前5行数据(.sql文件),发现导入无效。而第三步和第五步中同样是.sql文件,使用“导入表”功能都可以导入。

对边上面的.sql文件发现,其原因在于第二步中导出的.sql文件中没有定义表结构,也就是没有创建表。将其中的insert语句复制到第五步中的表结构sql文件中,就可以实现导入表了。

这样导入的表也就是只有原表中前5行数据的表了。

处理后的.sql文件如下:

----------------------------------------------------
-- Export file for user SYSTEM --
-- Created by Administrator on 2017-5-3, 13:09:02 --
---------------------------------------------------- set define off
spool guanxi.log prompt
prompt Creating table IGIS_LOCATION_COPY
prompt =================================
prompt
create table SYSTEM.IGIS_LOCATION_COPY
(
devicecode VARCHAR2(50) not null,
type VARCHAR2(10) not null,
longitude NUMBER(10,2) not null,
latitude NUMBER(10,2) not null,
datetime DATE not null
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('001FF92FABE165', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('004999010640000', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('012963007793321', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013437006991011', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013789000795180', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); spool off

7、注意:假如发现自己使用plsql导出的表无法导入,极可能是因为在导出表的时候没有选上“创建表”这一项。上一步中的介绍可猜测,在导出前5行数据的时候,默认的没有创建表。

挂两个外链,管理员请不要删我文,如违规可联系我自行修改删除,QQ:919497132

苏州空调维修 苏州冰箱维修

plsql基本操作 复制表 导出表 导出表结构 及其导入的更多相关文章

  1. sql developer Oracle 数据库 用户对象下表及表结构的导入导出

    Oracle数据库表数据及结构的导入导出   导出的主机与即将导入到的目标主机的tablespace 及用户名需一直!!!!!

  2. Oracle中如何导出存储过程、函数、包和触发器的定义语句?如何导出表的结构?如何导出索引的创建语句?

    Oracle中如何导出存储过程.函数.包和触发器的定义语句?如何导出表的结构?如何导出索引的创建语句? QQ群里有人问:如何导出一个用户下的存储过程?   麦苗答:方法有多种,可以使用DBMS_MET ...

  3. 小甲鱼PE详解之输入表(导出表)详解(PE详解09)

    小甲鱼PE详解之输出表(导出表)详解(PE详解09) 当PE 文件被执行的时候,Windows 加载器将文件装入内存并将导入表(Export Table) 登记的动态链接库(一般是DLL 格式)文件一 ...

  4. 取PE文件的引入表和导出表

    直接上代码(这里列出C++和Delphi的代码),Delphi代码中包含导入及导出文件和函数列表,PE结构可参阅资料,很多很详细,需要注意的是,本例中是映射到内存,不是通过PE装载器装入的,所以对于节 ...

  5. MySQL 复制表结构

    200 ? "200px" : this.width)!important;} --> 介绍 有时候我们需要原封不动的复制一张表的表结构来生成一张新表,MYSQL提供了两种便 ...

  6. SQL复制表结构或表数据

    需求: 软件开发过程中,一般会部署两个数据库:一个测试数据库提供给开发和测试过程使用:一个运维数据库提供上线使用.当需求变化需增加表时,会遇到数据库表结构或表数据同步的问题,这时就要复制表结构或表数据 ...

  7. ORCALE复制表结构

    1.oracle 复制表结构 不要内容 create table 表1 as select * from 表2 where 1=2 2.oracle 复制表结构 要内容 create table 表1 ...

  8. mysql 复制表结构、表数据的方法

    From: http://blog.163.com/yaoyingying681@126/blog/static/109463675201191173221759/ MySQL 添加列,修改列,删除列 ...

  9. mysql复制表结构及检查表、存储过程是否存在

    mysql命令行复制表结构的方法: 1.只复制表结构到新表 CREATE TABLE 新表 SELECT * FROM 旧表 WHERE 1=2  或者 CREATE TABLE 新表 LIKE 旧表 ...

随机推荐

  1. javascript Date对象 之 时间转字符串

    javascript Date对象 --> 时间转字符串: 测试代码: <!DOCTYPE html> <html lang="en"> <he ...

  2. 【leetcode刷题笔记】Rotate Image

    You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...

  3. Apache 静态缓存配置

    静态文件缓存 静态缓存在客户端下进行缓存,可以设置缓存文件类型与缓存时间,提升客户端访问站点速度. 语法格式 ExpiresByType type/encoding “<base> [pl ...

  4. ubuntu linux 1604 编译安装tesseract-ocr 4.0

    主要参考官方的编译,梳理一下整个流程 Linux The build instructions for Linux also apply to other UNIX like operating sy ...

  5. 20145109 《Java程序设计》第四周学习总结

    20145109 <Java程序设计>第四周学习总结 教材学习内容总结 Chapter 6 Inheritance & Polymorphism What is Inheritan ...

  6. python图片文字识别笔记

    我的环境为python3 坑比较多,在此做记录,以备查阅 命令行安装: pip install PIL pip install pytesseract pip install Pillow 下载tes ...

  7. Win32 API编程:显示系统进程列表

    #include <windows.h> #include <tlhelp32.h> // 声明快照函数的头文件 #include "tchar.h" #i ...

  8. NOIP 转圈游戏

    描述 n 个小伙伴(编号从 0 到 n-1)围坐一圈玩游戏.按照顺时针方向给 n 个位置编号,从0 到 n-1.最初,第 0 号小伙伴在第 0 号位置,第 1 号小伙伴在第 1 号位置,……,依此类推 ...

  9. Linux内核模块编写详解

    内核编程常常看起来像是黑魔法,而在亚瑟 C 克拉克的眼中,它八成就是了.Linux内核和它的用户空间是大不相同的:抛开漫不经心,你必须小心翼翼,因为你编程中的一个bug就会影响到整个系统,本文给大家介 ...

  10. MSER(Maximally Stable Extremal Regions)算法总结

    ER与ER Tree形成过程 判断ER是否位MSER条件 MSER源码分析