Oracle DB add new user from windows

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

1: key in sqlplus from command window, input user name and pw, pw is created when install oracle db, user name is system default user name

C:\Users\Administrator>sqlplus

SQL*Plus: Release 18.0.0.0.0 - Production on Thu Oct 13 22:21:32 2022
Version 18.4.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Enter user-name: SYSTEM
Enter password:
Last Successful login time: Thu Oct 13 2022 22:12:27 -07:00

Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

 

2: run below command

SQL> ALTER SESSION SET"_ORACLE_SCRIPT"=TRUE;

Session altered.

 

3: create new user ''comfort" and password "password"

SQL> CREATE USER comfort IDENTIFIED BY password;

User created.

 

4: Grant dba to this new user, 

SQL> grant dba to comfort;

Grant succeeded.

 

Try import db here(do exp first from original db server with below command: exp SYSTEM/password@127.0.0.1:1521/XE owner=SYSTEM file=C:\Temp\test.dmp)

Take note, imp and exp command is not under sqlplus mode, just normal command window key in exp and imp command

imp comfort/password@XE file=C:\CastlesTMSDb\XE_220407.dmp log=C:\CastlesTM
below is part of import success log for reference only:

----------------------------------------------------------------------------------------

IMP-00041: Warning: object created with compilation warnings
"CREATE FORCE VIEW "COMFORT"."MVIEW_EXCEPTIONS" "
" "
" ("RUNID","OWNER","TABLE_NAME","DIMENSION_NAME","RELATION"
"SHIP","BAD_ROWID") AS "
"select"
" t1.runid# as runid,"
" owner,"
" table_name,"
" dimension_name,"
" relationship,"
" bad_rowid"
"from SYSTEM.MVIEW$_ADV_EXCEPTIONS t1, SYSTEM.MVIEW$_ADV_LOG t2, ALL_USERS u"
"where"
" t1.runid# = t2.runid# and"
" u.username = t2.uname and"
" u.user_id = userenv('SCHEMAID')"
Import terminated successfully with warnings.

C:\Users\Administrator>

----------------------------------------------------------------------------------------

posted @ 2022-10-14 13:32  renren0113  阅读(48)  评论(0)    收藏  举报