1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| truncate TABLE 表名
select session_id from v$locked_object (结果:370)
SELECT sid, serial
ALTER SYSTEM KILL SESSION '370,2696'
alter table test add name1 clob
update test set name1=name
alter table test drop column name
alter table test rename column name1 to name
SELECT UPPER(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)", D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)", TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') || '%' "使用比", F.TOTAL_BYTES "空闲空间(M)", F.MAX_BYTES "最大块(M)" FROM (SELECT TABLESPACE_NAME, ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES, ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES FROM SYS.DBA_FREE_SPACE GROUP BY TABLESPACE_NAME) F, (SELECT DD.TABLESPACE_NAME, ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB FROM SYS.DBA_DATA_FILES DD GROUP BY DD.TABLESPACE_NAME) D WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME ORDER BY 1;
select * from sysdate
> (TO_DATE(CONCAT(substr(TO_CHAR(sysdate, 'YYYY-MM-DD HH24:MI:SS'),0,4),'-01-01 00:00:00'),'YYYY-MM-DD HH24:MI:SS'))
CREATE TABLESPACE 表空间名 DATAFILE '/orcl_data/AICRIS_dev1.dbf' SIZE 30G;
create user 用户名 identified by 用户密码 default tablespace 表空间名;
grant create table to 用户名; grant connect to 用户名; alter user aicris quota unlimited on 表空间名;
su - oracle
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
exp '用户名/"密码"@IP:1521/数据库名' file=/orcl_data/20200625/备份源.dmp log=/orcl_data/20200625/备份日志.log
imp '用户名/"密码"' file=/orcl_data/20200625/备份源.dmp log=/orcl_data/20200625/还原日志.log full=y
sqlplus / as sysdba; CREATE user admin identified by chinaweal2020 alter user admin account unlock grant create session to admin
GRANT resource,connect,dba to admin
GRANT connect to admin
select 'grant SELECT , INSERT, UPDATE, DELETE on '||OWNER||'.'||TABLE_NAME||' to ADMIN;' from all_tables where OWNER='AICORG'
create user SysAdmin identified by "123456" default tablespace SYSTEM temporary tablespace TEMP profile DEFAULT;
grant execute on SYS.DBMS_ALERT to SysAdmin; grant execute on SYS.DBMS_AQ to SysAdmin with grant option; grant execute on SYS.DBMS_AQADM to SysAdmin with grant option; grant execute on SYS.DBMS_AQELM to SysAdmin with grant option; grant execute on SYS.DBMS_AQ_IMPORT_INTERNAL to SysAdmin with grant option; grant execute on SYS.DBMS_DEFER_IMPORT_INTERNAL to SysAdmin; grant execute on SYS.DBMS_REPCAT to SysAdmin; grant execute on SYS.DBMS_RULE_EXIMP to SysAdmin with grant option; grant execute on SYS.DBMS_SQL to SysAdmin; grant execute on SYS.DBMS_SYS_ERROR to SysAdmin; grant execute on SYS.DBMS_SYS_SQL to SysAdmin; grant execute on SYS.DBMS_TRANSFORM_EXIMP to SysAdmin with grant option; grant select, insert, update, delete, references, alter, index on SYS.INCEXP to SysAdmin; grant select, insert, update, delete, references, alter, index on SYS.INCFIL to SysAdmin; grant select, insert, update, delete, references, alter, index on SYS.INCVID to SysAdmin; grant select on WMSYS.WM$UDTRIG_INFO to SysAdmin; grant aq_administrator_role to SysAdmin with admin option; grant dba to SysAdmin with admin option; grant unlimited tablespace to SysAdmin with admin option;
|