SDEHOME #ArcSDE安装的地方
ORACLE_HOME #Oracle安装的地方
ORACLE_SID #Oracle SID的值
TNS_ADMIN #tnsnames.ora文件所在的地方
PATH $PATH:$SDEHOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH $SDEHOME/lib:/usr/lib:/lib:$ORACLE_HOME/lib (All platforms except HP and IBM)
SHLIB_PATH $SDEHOME/lib:/usr/lib:/lib:$ORACLE_HOME/lib (for HP only)
LIBPATH $SDEHOME/lib:/usr/lib:/lib:$ORACLE_HOME/lib (for IBM only)
TWO_TASK #value for TWO_TASK (if ArcSDE and Oracle on different machines)
如果Oracle数据库安装在本地,那么ORACLE_HOME和ORACLE_SID是需要设置并且起作用的,而,如果设置了TWO_TASK,那么它们就不起作用。
TWO_TASK指出在远程安装的Oracle的地址。如果在本地安装的Oracle,那么就不需要指出TNS_ADMIN和TWO_TASK。
注意:ArcSDE启动的时候,giomgr进程会读取$SDEHOME/etc/dbinit.sde文件中的设置,这会覆盖掉在.profile文件中的设置。
我的环境变量的设置如下:
umask 022export ORACLE_BASE=/opt/oracleexport SDEHOME=/home/sde/sdeexe91export ORACLE_HOME=/opt/oracleexport ORACLE_SID=GISexport PATH=$SDEHOME/bin:$ORACLE_HOME/bin:$PATHexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:$SDEHOME/lib:/usr/lib:/lib:$LD_LIBRARY_PATH:$ORACLE_HOME/lib/stubs
d. 创建Oracle数据库用户和tablespace。
i. 创建tablespace。
tablespace至少需要200M的空间,我们这里创建成2G,最大是unlimited。
由于Oracle推荐使用本地管理表空间,那么这里就设置成本地管理。关于本地管理和数据字典管理的定义和比较,请参阅下面的文档:
Locally Managed Tablespaces:
A tablespace that manages its own extents maintains a bitmap in each datafile to keep track of the free or used status of blocks in that data file. Each bit in the bitmap corresponds to a block or a group of blocks. When an extent is allocated or freed for reuse, the Oracle server changes the bitmap values to show the new status of the blocks.
Dictionary-Managed Tablespaces:
For a tablespace that uses the data dictionary to manage its extents, the Oracle server updates the appropriate tables in the data dictionary whenever an extent is allocated or deallocated.
Advantages of Locally Managed Tablespaces:
Locally managed tablespaces have the following advantages over dictionary-managed tablespaces:
Local management avoids recursive space management operations, which can occur in dictionary-managed tablespaces if consuming or releasing space in an extent results in another operation that consumes or releases space in a undo segment or data dictionary table.
Because locally managed tablespaces do not record free space in data dictionary tables, it reduces contention on these tables.
Local management of extents automatically tracks adjacent free space, eliminating the need to coalesce free extents.
The sizes of extents that are managed locally can be determined automatically by the system. Alternatively, all extents can have the same size in a locally managed tablespace.
Changes to the extent bitmaps do not generate undo information because they do not update tables in the data dictionary (except for special cases such as tablespace quota information).
关于这两种管理方式性能的比较可以参看http://db.rdxx.com/Oracle/2006-5/18/190634694.shtml
创建tablespace的语句是:
CREATE TABLESPACE sde DATAFILE'/opt/oradata/GIS/SDE/SDE.dbf' SIZE 2000MAUTOEXTEND ONNEXT 32MMAXSIZE UNLIMITEDLOGGINGEXTENT MANAGEMENT LOCAL UNIFORM SIZE 1MSEGMENT SPACE MANAGEMENT AUTO;
在做这部之前,需要用oracle用户登录,然后在/opt/oradata/GIS/下创建SDE文夹。
其中,EXTENT MANAGEMENT LOCAL是指本地管理方式,UNIFORM 是指对于一个表来说,每次增加分配的空间大小(extent的大小)。
而NEXT是指对于tablespace来说,每次空间不够的时候再次分配的大小。
这里有一段话,可以表明这两者的一些区别:
“每次分配extent时是一个消耗资源的操作,当然是分配次数越少越好。在有些情况下,这也会直接影响性能。例如,在执行批量插入时,如果你的 extent太小,很快就要用完,就得再分配下一个,这时insert进程就只能等待系统去分配下一个extent.在这种情况下分配大一点的 extent会有助于