ORACLE creates tablespaces, creates users, modifies user default tablespaces, and grants and views permissions. oracle Permissions
Oracle creates users, tablespaces, imports and exports,... commands
// Create a temporary tablespace
Create temporary tablespace ext_temp
Tempfile 'd: \ oracle \ product \ 10.2.0 \ oradata \ test \ ext_temp.dbf'
Size 32 m
Autoextend on
Next 32 m maxsize 2048 m
Extent management local;
// Create a data table space
Create tablespace ext_data
Logging
Datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ test \ ext_data.dbf'
Size 32 m
Autoextend on
Next 32 m maxsize 2048 m
Extent management local;
// Create a user and specify the tablespace
Create user test identified by test
Default tablespace test_data
Temporary tablespace test_temp;
// Grant permissions to users
Grant connect, resource to test; (db2: Specify all permissions)
(To be honest, these permissions are used in development. If you create a production environment, create system permissions for the user)
It is said that in the production environment, only the role like connect resource can be used.
GRANT "CONNECT" TO test;
GRANT "RESOURCE" TO test;
GRANT "DBA" TO test;
GRANT "EXP_FULL_DATABASE" TO test;
GRANT "IMP_FULL_DATABASE" TO test;
Delete A User: for example, if user A is created, you can delete the user.
Connect sys/password as sysdba;
Drop user A cascade; // the user is deleted.
Change the password and unlock
Alter user "SCOTT" identified "*******"
Alter user "SCOTT" ACCOUNT UNLOCK
1. View All Users:
Select * from dba_user;
Select * from all_users;
Select * from user_users;
2. view the user's system permissions:
Select * from dba_sys_privs;
Select * from all_sys_privs;
Select * from user_sys_privs;
3. View user object permissions:
Select * from dba_tab_privs;
Select * from all_tab_privs;
Select * from user_tab_privs;
4. view all roles:
Select * from dba_roles;
5. view the roles owned by the user:
Select * from dba_role_privs;
Select * from user_role_privs;
Import and Export commands:
Importing and exporting Oracle Data imp/exp is equivalent to restoring and backing up oracle data. The exp command can export data from the remote database server to the local dmp file, and the imp command can import the dmp file from the local to the distant database server. This function can be used to build two identical databases, one for testing and the other for formal use.
Execution environment: it can be executed in SQLPLUS. EXE or DOS (command line,
In DOS, the installation directory ora81BIN in oracle 8i is set as a global path,
The EXP. EXE and IMP. EXE files in this directory are used for import and export.
Oracle is written in java. SQLPLUS. EXE, EXP. EXE, and IMP. EXE files may be packaged class files.
SQLPLUS. EXE calls the classes encapsulated by EXP. EXE and IMP. EXE to complete the Import and Export function.
The following describes the Import and Export instances.
Data export:
1. Export the database TEST completely, and the username system Password manager is exported to D: daochu. dmp.
Exp system/manager @ TEST file = d: daochu. dmp full = y
2. Export the tables of system users and sys users in the database
Exp system/manager @ TEST file = d: daochu. dmp owner = (system, sys)
3. Export the inner_policy and policy_staff_relat tables in the database.
Exp aichannel/aichannel @ TESTDB2 file = d: datanewsmgnt. dmp tables = (inner_policy, policy_staff_relat)
4. Export the data with the field filed1 in table 1 in the database starting with "00"
Exp system/manager @ TEST file = d: daochu. dmp tables = (table1) query = "where filed1 like '201312 '"
The above is a commonly used export. For compression, you can use winzip to compress the dmp file.
You can also add compress = y to the command above.
Data Import
1. import data from D: daochu. dmp to the TEST database.
Imp system/manager @ TEST file = d: daochu. dmp
Imp aichannel/aichannel @ HUST full = y file = d: datanewsmgnt. dmp ignore = y
The above may be a problem, because some tables already exist, and then it will report an error, the table will not be imported.
Add ignore = y to the end.
2. Import table 1 in d: daochu. dmp
Imp system/manager @ TEST file = d: daochu. dmp tables = (table1)
The preceding import and export operations are sufficient. In many cases, you must first completely delete the table and then import it.
Note:
If the operator has sufficient permissions, a prompt is displayed.
Databases can be connected. You can use tnsping TEST to obtain whether the database TEST can be connected.
Appendix 1:
Add data import permissions to users
First, start SQL * puls
Second, log in with system/manager
Third, create user username identified by password (this step can be omitted if you have already created a user)
Fourth, grant create user, drop user, alter user, create any view,
Drop any view, EXP_FULL_DATABASE, IMP_FULL_DATABASE,
DBA, CONNECT, RESOURCE, create session to Username
Fifth, run-cmd-to enter the directory where the dmp file is located,
Imp userid = system/manager full = y file = *. dmp
Or imp userid = system/manager full = y file = filename. dmp
Example:
F: WorkOracle_Databackup> imp userid = test/test full = y file = inner_policy.dmp
Screen Display
Import: Release 8.1.7.0.0-Production on Thursday February 16 16:50:05 2006
(C) Copyright 2000 Oracle Corporation. All rights reserved.
Connect to: Oracle8i Enterprise Edition Release 8.1.7.0.0-Production
With the Partitioning option
JServer Release 8.1.7.0.0-Production
EXPORT the files created by EXPORT: V08.01.07 in the normal path
The ZHS16GBK Character Set and ZHS16GBK NCHAR character set have been imported.
The export server uses the UTF8 NCHAR character set (possible ncharset conversion)
. Importing AICHANNEL object to AICHANNEL
.. Importing table "inner_policy" 4 rows
Prepare to enable constraints...
Import is terminated successfully, but a warning is displayed.
Appendix 2:
Oracle cannot directly change the table owner. Export/Import can be used to achieve this purpose.
First create import9.par,
The command is as follows: imp parfile =/filepath/import9.par
The content of import9.par is as follows:
FROMUSER = TGPMS
TOUSER = TGPMS2 (Note: You can change the table owner from FROMUSER to TOUSER. Users of FROMUSER and TOUSER can be different)
ROWS = Y
INDEXES = Y
GRANTS = Y
CONSTRAINTS = Y
Buffer= 409600
File =/backup/ctgpc_20030623.dmp
Log =/backup/import_20030623.log