linux
oracle注册表字符集环境变量设置?
一、oracle注册表字符集环境变量设置?
注册表中NLS_LANG键下设置相应字符集。
二、LINUX下Oracle数据导入导出的方法详解?
在“运行”里打开cmd
2
输入命令:sqlplussystem/123456@orcl
其中system是登录数据库的用户名
123456是用户名的密码
orcl是数据库实例名称
3
如果提示命令无效,那就是你没有配置好oracle的环境变量(想当年我也被这个问题困扰着),配置oracle环境变量的方法如下:
1、右击“我的电脑”->选择“属性”->选择“高级”->单击“环境变量”2、选择“path”这一行,单击“编辑”,在“path”的变量值文本框的最后面先加入一个分号“:”,然后再分号后面加入sqlplus文件的目录路径,如“c:\programfiles\oracle\product\10.2.0\db_1\bin”,然后点击“确定”按钮。3、如果在“系统变量”列表框下面的“变量”列中找不到“oracle_home”和“oracle_sid”这两个变量,则需要下面操作,否则无需一下操作。4、在“系统变量”中点击“新建”按钮,在“变量名”中输入“oracle_home”,变量值中输入oracle的安装目录路径,如“c:\programfiles\oracle\product\10.2.0\db_1”,然后点击“确定”按钮。5、在“系统变量”中点击“新建”按钮,在“变量名”中输入“oracle_sid”,变量值中输入数据库的实例名,然后点击“确定”按钮。
oracle_home:oracle数据库软件的安装目录oracle_sid:oracle数据库的实例名oracle数据库实例名:用于和操作系统进行联系的标识,即数据库和操作系统之间的交换是通过数据库实例名来体现的。
end
第二步,expdp备份命令
1
创建oracle的备份目录:
sql>createdirectorydpdata1as'd:\temp\dmp';
这仅仅是在oracle里设定的目录,并没有真正创建
2
可以通过这句命令查看到这个目录
sql>select*fromdba_directories;
3
赋于要导出数据表的所属用户权限
sql>grantread,writeondirectorydpdata1tosshe;
4
好了,到了关键一步,之前走了不少弯路,但其它是小问题,在网上零零碎碎查了很多资料,终于找到原因。
首先,要切换回命令窗口,不要再在sql>下运行,然后输入命令:
expdpsystem/123456@orcldirectory=dpdata1dumpfile=sshe.dmplogfile=sshe.logschemas=sshe
5
上面报了一个错ora-39002:操作无效
原因是d:\temp\dmp这个目录不存在,别以为createdirectory之后就会自动生成文件夹,也别以为执行expdp后会自动生成文件夹,要自己手动新建这个目录文件夹的。新建文件夹后再试一下,果然成功了!恭喜你,已成功备份!
6
如果你要问,导出来的dmp文件怎样还原回去。好吧,做人做到底,为了省去你再找方法的麻烦,这里我也做一个演示(一般备份的数据是等到数据库有问题时才用的上)。
首先,再一次登录数据库sqlplussystem/123456@orcl
然后,删除目标数据库用户dropusersshecascade;
7
现在来再一次创建用户,可以用命令创建,也可以在plsql里创建,这里在plsql创建。
用system登录数据库,然后右键users--新建
然后填写你的账号名称,必须和备份时的用户一致,并赋于相应的权限
最后点击应用,完成用户创建。
8
返回dos命令窗口,不再是sql>
输入导入命令:impdpsystem/123456@orcldirectory=dpdata1dumpfile=sshe.dmplogfile=sshe.logschemas=sshe
导入成功!
end
步骤3定时执行备份任务
做一个按年月日命名的批处理。在d:\temp\目录下新建一个文件,随便命名为.bat,我的命名为sshe.bat,编辑为如下代码
-------------------------------------------------------------------------
@echooffremsetbackupfile=f_database_%date:~0,4%-%date:~5,2%-%date:~8,2%.dmpremsetlogfile=f_database_%date:~0,4%-%date:~5,2%-%date:~8,2%.logremdelete30daysfilesforfiles/p"d:\temp\dmp"/d-30/c"cmd/cechodeleting@file...&&del/f@path"cdd:\temp\dmp
rembackupschemassetbackupfile=sshe_%date:~0,4%-%date:~5,2%-%date:~8,2%.dmpsetlogfile=sshe_%date:~0,4%-%date:~5,2%-%date:~8,2%.logexpdpsshe/sshedirectory=dir_dpdumpfile=%backupfile%logfile=%logfile%schemas=ssheparallel=4
-------------------------------------------------------------------------------
可以试执行一下,会自动生成一个以年月日命名的备份文件
forfiles/p"d:\temp\dmp"/d-30/c"cmd/cechodeleting@file...&&del/f@path"的作用是:删除本目录下30天以后的备份文件,这个挺有用的。
做一个windows每晚自动运行数据库备份的bat,我的命名为auto.bat编辑如下内容
------------------------------------------------------------------------------
@echooffschtasks/create/tnsshe数据库定时备份/tr"d:\temp\sshe_bak.bat"/scdaily/st00:00:00/ru"system"pauseexit
------------------------------------------------------------------------------
双击auto.bat,就会在windows添加一个定时任务,每晚0点0分就会自动执行一次sshe.bat,从而完成自动备份的目的。
右键我的电脑:管理——任务计划程序——任务计划程序库,可以看到刚才添加进去的定时任务
5
可以将电脑的时钟设为23点59分50秒,等待10秒钟,看看自动备份能否成功。如果成功那就大功告成了!!
三、oracle忘记用户名和口令怎么办?
登录到安装oracle数据库服务器的操作系统。打开命令窗口:(我的演示机器是windows)
2
查看环境变量ORACLE_SID的设置情况:
windows: echo %ORACLE_SID%
linux: echo $ORACLE_SID
3
设置环境变量ORACLE_SID的值为你想登录的oracle实例的SID:
set ORACLE_SID=orcl
4
键入命令:sqlplus / as sysdba
就可以以sysdba的身份登录到oracle了!
linux系统下,如果找不到sqlplus命令的话,请切换到oracle用户。
5
在sqlplus窗口执行命令:
alter user you_username identified by you_password;
就可以修改你的用户的密码了~
四、在DOS窗口中使用sqlplus /nolog命令登录oracle,结果报类似“sqlplus不是内部或外部命令”该怎么办?
简单加入系统的环境变量就可以了我的电脑——属性——高级——环境变量在path中添加oracle10g的sqlpus.exe的文件路径,比如我的是D:\oracle\product\10.1.0\Db_1\BIN那么就在就在Path中加入上面这个就可以了当然前提是D:\oracle\product\10.1.0\Db_1\BIN目录下必须有sqlplus。exe文件才行,如果没有的话,那么你只能重新安装了
五、安装oracle10g时,环境变量怎么设置?
首先你可以打开自己的电脑,然后找到此电脑,再此电脑里面有一个属性,然后在高级属性里面设置好oracle数据库的路径,然后添加进环境变量就可以了。
六、在创建Oracle数据库时出现ORA 12560:协议适配器错误是怎么回事?
造成ORA-12560:TNS:协议适配器错误的问题的原因有三个:
1.监听服务没有起起来。
windows平台个一如下操作:开始---程序---管理工具---服务,打开服务面板,启动oraclehome92TNSlistener服务。
2.databaseinstance没有起起来。
windows平台如下操作:开始---程序---管理工具---服务,打开服务面板,启动oracleserviceXXXX,XXXX就是你的databaseSID.3.注册表问题。
regedit,然后进入HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0将该环境变量ORACLE_SID设置为XXXX,XXXX就是你的databaseSID.或者右几我的电脑,属性--高级--环境变量---系统变量--新建,变量名=oracle_sid,变量值=XXXX,XXXX就是你的databaseSID.或者进入sqlplus前,在commandline下输setoracle_sid=XXXX,XXXX就是你的databaseSID.经过以上步骤,就可以解决问题。
七、怎么在ubuntu上安装oracle数据库?
你执行命令的时候是否设置了oracle_home这个环境变量?echo$ORACLE_HOME能否出值?另外不建议用ubuntu,它是不被oracle认证的,就算能装上,也很容易出现问题。可以考虑使用oraclelinux或者redhatlinux代替。
热点信息
-
在Python中,要查看函数的用法,可以使用以下方法: 1. 使用内置函数help():在Python交互式环境中,可以直接输入help(函数名)来获取函数的帮助文档。例如,...
-
一、java 连接数据库 在当今信息时代,Java 是一种广泛应用的编程语言,尤其在与数据库进行交互的过程中发挥着重要作用。无论是在企业级应用开发还是...
-
一、idea连接mysql数据库 php connect_error) { die("连接失败: " . $conn->connect_error);}echo "成功连接到MySQL数据库!";// 关闭连接$conn->close();?> 二、idea连接mysql数据库连...
-
要在Python中安装modbus-tk库,您可以按照以下步骤进行操作: 1. 确保您已经安装了Python解释器。您可以从Python官方网站(https://www.python.org)下载和安装最新版本...