select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表
2、查找表的主键(包括名称,构成列):
select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' and au.table_name = 要查询的表
3、查找表的唯一性约束(包括名称,构成列):
select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'U' and au.table_name = 要查询的表
4、查找表的外键(包括名称,引用表的表名和对应的键名,下面是分成多步查询):
select * from user_constraints c where c.constraint_type = 'R' and c.table_name = 要查询的表
查询外键约束的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键名称
查询引用表的键的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名
5、查询表的所有列及其属性
PPAS有两个迁移工具,一个图形界面的,一个命令行的,下面以图形界面为例。1
首先需要在目标数据库系统PPAS上建立和源库对应的用户和对等的权限,再建立目标数据库。
create user " USERNAMEXXX " withsuperuser password 'xxxxxx'
create database DatabaseNameowner="TYTUTOR" encoding='utf8'
2
根据jre版本(当前环境是1.4版)把Oracle数据库的驱动程序拷贝到如下目录
/opt/PostgresPlus/9.2AS/jre/lib/ext/ojdbc14.jar
3
运行PPAS迁移工具
4
5
在servers上右键点击增加迁移的源和目标数据库
6
7
在左侧oracle源数据库上右键点击要迁移的schema,现在在线迁移
8
选择目标数据库,schema,点击run
Ok了,开始迁移了,可以看过程中的信息提示或迁移日志文件,oracle迁移到pg可能有很多pl/sql的数据库对象都会失败,要迁到ppas就好多了,因为ppas有oracle兼容引擎。
都搞定后就可以迁移应用程序了,这又是一堆事。
PPAS还有个命令行的迁移工具,比图形界面可以有对迁移过程有更多控制,具体见下面其可带的参数:
ot@host1 9.2AS]#jre/bin/Java -jar bin/edb-migrationtoolkit.jar -help
EnterpriseDBMigration Toolkit (Build 46)
Usage: runMTK[-options] SCHEMA
If no option isspecified, the complete schema will be imported.
where optionsinclude:
-helpDisplay the application command-lineusage.
-versionDisplay the application version information.
-verbose [on|off]Display application log messages on standard output (default: on).
-schemaOnly Import the schema object definitions only.
-dataOnly Import the table data only. When -tablesis in place, it imports data only for the selected tables. Note: If there areany FK constraints defined on target tables, use -truncLoad option along withthis option.
-sourcedbtypedb_type The -sourcedbtype option specifies the source database type. db_typemay be one of the following values: MySQL, oracle, sqlserver, sybase,postgresql, enterprisedb. db_type is case-insensitive. By default, db_type is oracle.
-targetdbtypedb_type The -targetdbtype option specifies the target database type. db_typemay be one of the following values: oracle, sqlserver, postgresql,enterprisedb. db_type is case-insensitive. By default, db_type is enterprisedb.
-allTables Import all tables.
-tables LIST Import comma-separated list of tables.
-constraints Import the table constraints.
-indexes Import the table indexes.
-triggers Import the table triggers.
-allViews Import all Views.
-views LIST Import comma-separated list of Views.
-allProcs Import all stored procedures.
-procs LISTImport comma-separated list of storedprocedures.
-allFuncs Import all functions.
-funcs LISTImport comma-separated list of functions.
-allPackagesImport all packages.
-packages LISTImport comma-separated list of packages.
-allSequences Import all sequences.
-sequences LISTImport comma-separated list of sequences.
-targetSchemaNAME Name of the target schema (default: target schema is named after sourceschema).
-allDBLinksImport all Database Links.
-allSynonyms It enables the migration of all public andprivate synonyms from an Oracle database to an Advanced Server database. If a synonym with the same name alreadyexists in the target database, the existing synonym will be replaced with themigrated version.
-allPublicSynonyms It enables the migration of all publicsynonyms from an Oracle database to an Advanced Server database. If a synonym with the same name alreadyexists in the target database, the existing synonym will be replaced with themigrated version.
-allPrivateSynonymsIt enables the migration of all privatesynonyms from an Oracle database to an Advanced Server database. If a synonym with the same name alreadyexists in the target database, the existing synonym will be replaced with themigrated version.
-dropSchema[true|false] Drop the schema if it already exists in the target database(default: false).
-truncLoad It disables any constraints on target tableand truncates the data from the table before importing new data. This optioncan only be used with -dataOnly.
-safeMode Transfer data in safe mode using plain SQLstatements.
-copyDelimiter Specify a single character to be used asdelimiter in copy command when loading table data. Default is \t
-batchSize Specify the Batch Size to be used by thebulk inserts. Valid values are 1-1000,default batch size is 1000, reduce if you run into Out of Memory exception
-cpBatchSize Specify the Batch Size in MB, to be used inthe Copy Command. Valid value is >0, default batch size is 8 MB
-fetchSize Specify fetch size in terms of number ofrows should be fetched in result set at a time. This option can be used whentables contain millions of rows and you want to avoid out of memory errors.
-filterProp The properties file that contains tablewhere clause.
-skipFKConst Skip migration of FK constraints.
-skipCKConst Skip migration of Check constraints.
-ignoreCheckConstFilter By default MTK does not migrate Checkconstraints and Default clauses from Sybase, use this option to turn off thisfilter.
-fastCopy Bypass WAL logging to perform the COPYoperation in an optimized way, default disabled.
-customColTypeMappingLIST Use custom type mapping representedby a semi-colon separated list, where each entry is specified usingCOL_NAME_REG_EXPR=TYPE pair. e.g. .*ID=INTEGER
-customColTypeMappingFilePROP_FILEThe custom type mappingrepresented by a properties file, where each entry is specified usingCOL_NAME_REG_EXPR=TYPE pair. e.g. .*ID=INTEGER
-offlineMigration[PATH] This performs offline migration and saves the DDL/DML scripts in filesfor a later execution. By default the script files will be saved under userhome folder, if required follow -offlineMigration option with a custom path.
-logDir LOG_PATHSpecify a custom path to save the log file. By default, on Linux the logs willbe saved under folder $HOME/.enterprisedb/migration-toolkit/logs. In case ofWindows logs will be saved under folder%HOMEDRIVE%%HOMEPATH%\.enterprisedb\migration-toolkit\logs.
-copyViaDBLinkOraThis option can be used to copy data using dblink_ora COPY commad. This optioncan only be used in Oracle to EnterpriseDB migration mode.
-singleDataFile Use single SQL file for offline datastorage for all tables. This option cannot be used in COPY format.
-allUsers Import allusers and roles from the source database.
-users LISTImport the selected users/roles from the source database. LIST is acomma-separated list of user/role names e.g. -users MTK,SAMPLE
-allRules Importall rules from the source database.
-rules LIST Importthe selected rules from the source database. LIST is a comma-separated list ofrule names e.g. -rules high_sal_emp,low_sal_emp
-allGroups Importall groups from the source database.
-groups LISTImport the selected groups from the source database. LIST is a comma-separatedlist of group names e.g. -groups acct_emp,mkt_emp
-allDomainsImport all domain, enumeration and composite types from the source database.
-domains LISTImport the selected domain, enumeration and composite types from the sourcedatabase. LIST is a comma-separated list of domain names e.g. -domainsd_email,d_dob, mood
-objecttypesImport the user-defined object types.
-replaceNullChar<CHAR>If null character is part of a column value, the data migrationfails over JDBC protocol. This option can be used to replace null characterwith a user-specified character.
-importPartitionAsTable[LIST] Use this option to import Oracle Partitioned table as a normal table inEnterpriseDB. To apply the rule on a selected set of tables, follow the optionby a comma-separated list of table names.
-enableConstBeforeDataLoadUse this option to re-enable constraints (and triggers) before data load. Thisis useful in the scenario when the migrated table is mapped to a partitiontable in EnterpriseDB.
-checkFunctionBodies[true|false] When set to false, it disables validation of the function bodyduring function creation, this is to avoid errors if function contains forwardreferences. Applicable when target database is Postgres/EnterpriseDB, defaultis true.
-retryCount VALUESpecify the number of re-attempts performedby MTK to migrate objects that failed due to cross-schema dependencies. TheVALUE parameter should be greater than 0, default is 2.
-analyze It invokes ANALYZE operation against a targetPostgres or Postgres Plus Advanced Server database. The ANALYZE collectsstatistics for the migrated tables that are utilized for efficient query plans.
-vacuumAnalyze It invokes VACUUM and ANALYZE operationsagainst a target Postgres or Postgres Plus Advanced Server database. The VACUUMreclaims dead tuple storage whereas ANALYZE collects statistics for themigrated tables that are utilized for efficient query plans.
-loaderCountVALUE Specify the number of jobs (threads)to perform data load in parallel. The VALUE parameter should be greater than 0,default is 1.
DatabaseConnection Information:
The applicationwill read the connectivity information for the source and target databaseservers from toolkit.properties file.
Refer to MTKreadme document for more information.
PPA,表示Personal Package Archives,也就是个人软件包集很多软件包由于各种原因吧,不能进入官方的Ubuntu软件仓库。为了方便Ubuntu用户使用,launchpad.net提供了ppa,允许用户建立自己的软件仓库,自由的上传软件。PPA也被用来对一些打算进入Ubuntu官方仓库的软件,或者某些软件的新版本进行测试。Launchpad是Ubuntu母公司canonical有限公司所架设的网站,是一个提供维护、支援或联络Ubuntu开发者的平台。
针对Ubuntu而言,用https://launchpad.net/ubuntu/+ppas搜索更加准确
添加源地址Ubuntu 9.10之后的版本,添加源地址、密钥等内容,只需要一条简单的命令即可
sudo add-apt-repository ppa:user/ppa-nameubtuntu10.04安装redis的ppa源
到https://launchpad.net/ubuntu/+ppas搜索“redis-server”通过上面说的指令将此ppa的源导入sudo add-apt-repository ppa:schwuk/redis 更新源安装redis即可,添加ppa的源相当于在sources list添加那两个软件源sudo apt-get update sudo apt-get install redis-server
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)