oracle配置sde函数库

发布时间 2023-09-01 15:36:05作者: 幸福在靠近

1、创建sde用户并授权

drop user sde cascade;
create user sde identified by cabletech;
grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to sde;
grant alter any index to SDE;
grant alter system to SDE;
grant create any index to SDE;
grant create any trigger to SDE;
grant create any view to SDE;
grant create indextype to SDE;
grant create library to SDE;
grant create operator to SDE;
grant create procedure to SDE;
grant create public synonym to SDE;
grant create sequence to SDE;
grant create session to SDE;
grant create table to SDE;
grant create trigger to SDE;
grant create type to SDE;
grant create view to SDE;
grant drop any index to SDE;
grant drop any view to SDE;
grant drop public synonym to SDE;
grant select any table to SDE;
grant EXECUTE ON DBMS_CRYPTO to sde;
Grant execute on dbms_pipe to sde;
Grant execute on dbms_lock to sde;

 2、创建表空间,必须要有/home/oracle/oradata这个目录

create tablespace sde datafile '/home/oracle/oradata/sde.dbf' size 256M autoextend on next 100M;

 3、找到$ORACLE_HOME/hs/admin/extproc.ora 文件

修改最后一行为:
SET EXTPROC_DLLS=ANY

 4、拷贝相关的st_shapelib.so 到$ORACLE_HOME/bin 或者$ORACLE_HOME/lib,用sde的账号执行

create or replace library st_shapelib as '/home/oracle/app/oracle/product/11.2.0/dbhome_2/lib/libst_shapelib.so'
查看路径是否正确:
select * from user_libraries;

5、重启数据库

6、创建oracle的目录

create directory sdedata as '/home/oracle/oradata';
grant read,write on directory sdedata to sde;
查看目录:
select * from dba_directories;

 7、将sde的备份库放到oracle的目录

impdp sde/123456 dumpfile=sde_20230830010501.dmp directory=sdedata schemas=sde logfile=sdedata.log

 8、切换sde用户,验证是否成功

select sde.st_geometry('point (101.02234 32.678833)' ,0) from dual;