create tablespace work01
datafile '/u01/oradata/orac/work01.dbf'
size 200m
autoextend on
next 20m
maxsize unlimited
extent management local;
6. 在要导入的数据库上查找用户是否已经存在
select username from dba_users where username='CMS';
如果存在:
drop user cms cascade; --(删除用户及其拥有的所有对象)
-- 此时如果这个用户在连接,drop会出错,必须先杀掉用户的session,然后再drop
SELECT 'alter system kill session '''||SID||','||SERIAL#||''' immediate;'
FROM V$SESSION
WHERE USERNAME='CMS';
alter system kill session '93,56387' immediate;
alter system kill session '100,18899' immediate;
alter system kill session '135,24910' immediate;
alter system kill session '149,3' immediate;
alter system kill session '152,3' immediate;
alter system kill session '156,7' immediate;
alter system kill session '159,45889' immediate;
alter system kill session '160,1' immediate;
alter system kill session '161,1' immediate;
alter system kill session '162,1' immediate;
alter system kill session '163,1' immediate;
--再复制这些语句,粘贴到sqlplus中执行,来杀掉Test2的session 。
如果不存在cms用户:
create user cms identified bycms default tablespace work01 temporary tablespace temp;
不管存不存在都应该给cms授权
【Oracle常用语句】grant connect,resource to cms;
7.最后将数据导入
下面在windows的cmd下将用户导进去
imp file=e:cms.dmp fromuser=cms touser=cms userid=cms/cms@orac
这里要注意的是之前我是用cms用户将数据导出来的,这个cms具有dba权限,那么这里导入的时候用的userid后面的cms也必须具有这个权限不然会报错
这里我们可以临时给cms赋予dba权限,最后回收他,但是回收之后,记得再给cms赋予resource权限NFO,USER_PROJECT_INFO) file=/home/oracle/osmp2.dmp
--11oracle如何生成awr报告
[root@localhost ~]# su - oracle
--查询生成awr报告生成位置
[oracle@localhost ~]$ pwd;
/home/oracle
oracle安装目录:
--oracle_home是oracle的产品目录 。
[oracle@localhost ~]$ echo $ORACLE_HOME
--oracle_base 是oracle的根目录,
[oracle@localhost ~]$ echo $ORACLE_BASE
[oracle@localhost ~]$ env |grep ORA
[oracle@localhost ~]$ lsnrctl status;
[oracle@localhost ~]$ export ORACLE_SID=FA
[oracle@localhost ~]$ sqlplus / as sysdba;
SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 10 10:15:41 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exec dbms_workload_repository.create_snapshot;
PL/SQL procedure successfully completed.
SQL> exec dbms_workload_repository.create_snapshot;
PL/SQL procedure successfully completed.
SQL> @?/rdbms/admin/awrrpt
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
2340707931 TEST 1 test
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 2340707931 1 TEST test localhost.lo
caldomain
Using 2340707931 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Enter value for num_days: 1
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
test TEST 319 22 Jun 2020 00:00 1
320 22 Jun 2020 01:00 1
321 22 Jun 2020 02:00 1
322 22 Jun 2020 03:00 1
323 22 Jun 2020 04:00 1
324 22 Jun 2020 05:00 1
推荐阅读
- ES的基本概念及常用命令
- 从感性到理性 经典语句?感性的说说心情随笔
- 向日葵花盘能喝吗,向日葵花盘煮水功效介绍
- 最常用的5种汽车音响改装方案
- oracle连接查询详解
- 藏红花对备孕有影响吗,藏红花男人可以喝吗
- mg是什么单位?
- RabbitMQ——最常用的三大模式
- 华为交换机查看端口相关信息常用命令,排查故障法宝,转发收藏
- 脑梗塞常用药4种药,桑叶药对