SelectEtoile : Base de connaissance SGBD

Posts Tagged 'ase'

Comment renommer un serveur SYBASE ASE

Exemple : Renommage de Serveur1 en Serveur2

 

1> select * from sysservers

2> go

 srvid  srvstatus srvname                        srvnetname                       srvclass srvsecmech

 ------ --------- ------------------------------ -------------------------------- -------- ------------------------------

      0         8 Serveur1                 Serveur1                          0 NULL

      1         8 SYB_BACKUP                     Serveur1_BK                          7 NULL

 

(3 rows affected)

1> begin tran

2> update sysservers set srvname='Serveur2' where srvid=0

3> go

(1 row affected)

1> update sysservers set srvnetname='Serveur2' where srvid=0

2> go

(1 row affected)

1> select * from sysservers

2> go

 srvid  srvstatus srvname                        srvnetname                       srvclass srvsecmech

 ------ --------- ------------------------------ -------------------------------- -------- ------------------------------

      0         8 Serveur2                    Serveur2                             0 NULL

      1         8 SYB_BACKUP                     Serveur1_BK                          7 NULL

 

(3 rows affected)

1> update sysservers set srvnetname='Serveur2_BK' where srvid=1

2> go

(1 row affected)

1> select * from sysservers

2> go

 srvid  srvstatus srvname                        srvnetname                       srvclass srvsecmech

 ------ --------- ------------------------------ -------------------------------- -------- ------------------------------

      0         8 Serveur2                    Serveur2                             0 NULL

      1         8 SYB_BACKUP                     Serveur2_BK                             7 NULL

 

(3 rows affected)

1> commit

2> go


Les fichiers à renommer et à modifier sont les fichier RUN* et .cfg.

Pour info, si le port est à changer, il suffit de le changer dans le fichier interfaces.

 

Articles tagged

Liste des traceflags sous SYBASE ASE

List of dbcc traceflags

 

 ExplanationSince versionUntill VersionBoot timeRun time
100 Display a parse tree for each command        
108 Allow dynamic and host variables in create view statements 12.5      
116 Print the text of the abstract query plan. Supported by Sybase, see documentation        
200 Display messages about the before image of the query-tree        
201 Display messages about the after image of the query tree        
208 Show types of locks taken        
217 Display a warning message for using the T-SQL extension of queries with grouped aggregates and columns in the select list which are not in the GROUP BY clause. 15.0.2 ESD 2      
241 Compress all query-trees when ASE is started        
243 Do not expand select * to column names when creating a compiled object        
244 When set, the maximum length of the returned value of str_replace() is 16384, otherwise it is 255. When Msg 511 is incorrectly raised with this flag on, upgrade to 15.0.2 ESD 6.        
260 Reduce TDS (Tabular Data Stream) overhead in stored procedures. Turn off done-in-behaviour packets. See also Send doneinproc tokens.        
291 Changes the hierarchy and casting of datatypes to pre-11.5.1 behaviour. There was an issue is some very rare cases where a wrong result could occur, but that's been cleared up in 11.9.2 and above.   11.9.2    
292 Never send doneinproc tokens. See also Send doneinproc tokens.        
298 Display an error message when a query uses a correlated variable as an inner or outer member of an outer join.        
299 Do not recompile a stored procedure that inherits a temp table from a parent procedure.        
302 Print trace information on index selection, supported by Sybase, see documentation   12.5 unless using compatibility mode in ASE 15   Y
303 Display optimizer OR strategy   12.5   Y
304 Revert special "or" optimizer strategy to the strategy used in pre-System 11 (this traceflag resolved several bug issues in System 11, most of these bugs are fixed in ASE 11.0.3.2)        
310 Show the plan as choosen by the optimizer, as well as I/O costs. Supported by Sybase see documentation   12.5 unless using compatibility mode in ASE 15   Y
311 Display optimizers expected I/O cost   12.5 unless using compatibility mode in ASE 15   Y
317 Show all considered plans. Supported by Sybase, see documentation   12.5 unless using compatibility mode in ASE 15   Y
319 Display optimizer reformatting strategy   12.5 unless using compatibility mode in ASE 15.   Y
320 Turn off join order heuristics   12.5    
321 Display optimizers reformatting strategy briefly   12.5 unless using compatibility mode in ASE 15.    
324 Turn off the like optimization for ad-hoc queries using local variables   12.5    
326 Instructs the server to use arithmetic averaging when calculating density instead of a geometric weighted average when updating statistics. Useful for building better stats when an index has skew on the leading column. Use only for updating the stats of a table/index with known skewed data.   11.5    
329 Turns on a strategy for fast first row return for queries using cursors with an ORDERBY. 15.0 ESD 2   Y N
333 Disables min-max optimization   12.5    
334 Enable merge joins   12.5 unless using compatibility mode in ASE 15.    
353 Turn off transitive closure        
364 Use range density instead of total density        
370 Use min-max index as an alternative to the table scan for single table queries. Does not perform aggregation optimization for joins.        
384 Enable JTC 12.0 12.5 unless using compatibility mode in ASE 15.    
396 Use min-max optimization for single table queries.        
441 queries where literal autoparametrization applies will be processed in full compatibility mode when enabled. Supported by Sybase, see documentation 15.0.3 ESD 1      
446 Disable restricted compatibility mode. Supported by Sybase, see documentation 15.0.3 ESD 1      
450 Sort a group by operation in the order of the groups 15      
457 Try to use worktables for a select in a cursor in order to isolate the selected data from the base table (12.5 behaviour) 15.0.2 ESD 6      
467 Do not cache a statement in the statement cache when a temp tables is referenced. 15.0.2 ESD 5      
477 When using compatibility mode, print a message about the type being used. Supported by Sybase, see documentation 15.0.3 ESD 1      
516 Print mapping between xchg operators and worker processes when using parallel execution. Supported by Sybase, see documentation 15      
526 Print semi-graphical execution operator tree when showplan is enabled. Supported by Sybase, see documentation        
589 Close a cursor implicitly during a cursor fetch and after an error was hit. 15.0.2 ESD 2      
602 Prints out diagnostic information for deadlock prevention.        
603 Prints out diagnostic information when avoiding deadlock.        
615 When a read of a page does not indicate it's right identity a second read is done. When the identity is now correct the related device is suspect and ASE turns on additional diagnostic checks. The check can be turned off with the traceflag. 12.5.3 ESD 5 and 15.0 ESD 2   Y Y
625 When hitting Msg 12328, do not regenerate the row-offset table 12.5.4 ESD 10      
646 Turn off the new space allocation method as introduced in 12.5.3 for partitioned DOL tables 12.5.3      
699 Turn off transaction logging        
712 Disable procedure cache optimisation        
722 ASE (debug version) will perform additional checks on the heap memory to detect possible memory corruption. 15.0 ESD 2   Y N
833 Do not report Msg 880 "Your query is blocked because it tried to write and database '<dbname>' is in quiesce state. Your query will proceed after the DBA performs QUIESCE DATABASE RELEASE.". 15.0 ESD 2 Y N  
990 Allow only access to the server with the "sa" account. Supported by Sybase, see documentation        
1116 Suppress Msg 1131. (The OAM page does not belong to object with index.....)        
1202 Also show the blocked lock requests in master..syslocks        
1204 Print deadlock information into errorlog        
1205 Prints deadlock information by printing stacktraces.        
1206 Disable lock promotion.        
1212 Shows info about locks granted and released        
1213 Used with dbcc object_stats        
1217 Show info about locks being acquired        
1603 Turns off async i/o and forces standard unix io. Can be useful if symptoms include transient corruption errors that may be caused by bad drives or controllers.        
1605 Start secondary engines by hand        
1606 Create a debug engine start file. This allows you to start up a debug engine which can access the server's shared memory for running diagnostics.        
1608 Instructs server engine 0 to not on-line any other dataserver engines        
1610 Boot the server with TCP_NODELAY enabled.     Y  
1611 If possible, pin shared memory -- check errorlog for success/failure.        
1613 Set affinity of the ASE engine's onto particular CPUs usually pins engine 0 to processor 0, engine 1 to processor 1, etc        
1615 SGI only: turn on recoverability to filesystem devices.        
1625 Linux only: Revert to using cached filesystem I/O. By default, ASE on Linux opens filesystem devices using O_SYNC, unlike other Unix based releases, which means it is safe to use filesystems devices for production systems. 11.9.2      
1630 SuSE 32 bit Linux (SuSE 9 SP1 or later), ASE incorrectly identifies AIO to be KAIO while using Posix AIO. Can lead to ASE hang. Start with this trace flag. 12.5.3 ESD 5 and 15.0 ESD 2   Y N
1642 Reserve one third of the sockets for EJB.        
1648 Enable DIRECT IO for block devices under on Linux        
1649 (linux on Intel, amd and IBM P) When set ASE uses Linux Kernel Asynchronous IO, rather than POSIX AIO 12.5.4 ESD 10      
1656 (Sun only) ASE will not boot when Intimate Shared Memory is not available. 12.5.4 ESD 10, 15.0.2 ESD 6      
2205 Show HA debugging output, supported by Sybase see documentation        
2209 Used when upgrading ASE configured with high availability        
2511 Suppress Msg 15082 during DBCC checks 12.5.4 ESD 10      
2512 Instructs dbcc checkalloc to skip the syslogs table during processing.        
2513 Instructs dbcc checkalloc, tablealloc and indexalloc to check for whether foreign objects are stranded on a particular segment within a database. Supported by Sybase, see documentation        
2703 When using update statistics with sampling and the index/column does not have existing statistics, set join density and total density to values from the sample rather then to defaults. 15.0 ESD 2      
3100 Load a database even when the characterset or sort order of a dump file is incompatible with the server.        
3199 When ONLINE DATABASE fails with Msg 2610 (Could not find leaf row in nonclustered index partition ...) after a cross-platform database load, set the traceflag on, reload the dump and online again. 15.0 ESD 2     Y
3300 Display each log record that is being processed during recovery. You may wish to redirect stdout because it can be a lot of information.        
3500 Disable checkpointing.        
3502 Write an entry in the errorlog when a databases is checkpointed        
3601 Write a stacktrace to the errorlog every time an error is raised.        
3604 Send trace output to the session of the client. Supported by Sybase see documentation       Y
3605 Send trace output to the errorlog of the server. Supported by Sybase see documentation       Y
3607 Do not start recovery when booting ASE.     Y  
3608 Recover only the master database. Do not clear tempdb or start up checkpoint process.     Y  
3609 Recover all databases. Do not clear tempdb or start up checkpoint process.        
3610 Pre-System 10 behaviour: divide by zero to result in NULL instead of error        
3620 Do not kill infected processes.        
3637 Connection time averages for LDAPUA are printed 12.5.4 ESD 10      
3706 Performance improvement of drop table in tempdb. 15.0 ESD 2   Y Y
3710 Improve the performance of DROP INDEX and CREATE INDEX by releasing the system catalog locks when not in DDL-IN-TRAN mode after the commit of the transaction but before post commit work started. 12.5.4 ESD 10, 15.0.2 ESD 4   Y Y
4001 Display a message in the errorlog when a loginrecord is recieved        
4012 Don't spawn chkptproc.        
4013 Write a message to the errorlog when a login takes place.        
4020 Boot without recover.     Y  
4044 Allows to log into ASE when the "sa" login is locked        
4072 Disable the global login trigger 15      
4073 Export the result of certain "set" command within a login trigger to the session. 15.0 ESD 2   Y  
4080 When an UPDATE using tsequal() is done within a stored procedure, tsequal() no longer returns a timestamp value unless the trace flag is set. 12.5.3 ESD 5 + 15.0 ESD 2      
4082 When set printing messages to console is made non-blocking 12.5.4 ESD 10      
4083 Disable SQLDBGR. 12.5.4 ESD 10   Y N
4084 Console logging will be disabled if setting console to nonblocking fails. 12.5.4 ESD 10, 15.0.2 ESD 5   Y N
4413 Trace queries in a 12.5 server that are join-order dependent.        
4419 In some cases, outer join on view or derived table with CASE expression may perform slower due to view materialization.The workaround is to use traceflag 4419. 12.5.4 ESD#6      
5101 Forces all I/O requests to go through engine 0. This removes the contention between processors but could create a bottleneck if engine 0 becomes busy with non-I/O tasks.        
5102 Prevents engine 0 from running any non-affinitied tasks.        
7103 Disable table lock promotion for text columns.        
7703 When assinging a value from a table into a local variable, go through the whole resultset rather than jump to last row and assing the value once.        
7717 Disable check of client compatibility in ASE 15. See Version 15 client compatibility 15.0.1      
7738 Support plan sharing of cached statements across different users. 15.0.2 ESD 2      
7741 Avoid Msg 257 when using statement cache and a parameterized statement without "dynamic prepare" and a incompatible parameter is specified as null. 12.5.4 ESD 10      
7815 logs address connection requests and host / name lookups.        
7841 Make ASE IPv6 aware. No longer needed since 15.0.2 ESD 5   15.0.2 ESD 5    
7844 Enable/disable concurrent Kerberos authentication        
7850 When set, timeout after 60 s when no Kerberos security opaque token is received from client 12.5.4 ESD 10      
8003 prints info on RPC calls        
8203 Display statement and transaction locks on a deadlock error.        
8399 Instructs the dbcc monitor command to insert a valid description into the field_name column in the sysmonitors table. Not intended for use by users. Appears in the errorlog when sp_sysmon is used.        
9217 When set, RepAgent will not stop after reporting error 9289 due to an inconsistent log record found. Instead it will attempt to continue after reporting error 9290 in the error log. Supported by Sybase, see documentation 15.0 ESD 2      
9531 Dump expensive buffer allocation analysis 15.0.2 ESD 2      
11201 Logs client connect events, disconnect events, and attention events. Supported by Sybase, see documentation        
11202 Logs client language, cursor declare, dynamic prepare, and dynamic execute-immediate text. Supported by Sybase, see documentation        
11203 Logs client rpc events. Supported by Sybase, see documentation        
11204 Logs all messages routed to client. Supported by Sybase, see documentation        
11205 Logs all interaction with remote server. Supported by Sybase, see documentation        
11206 Show messages about query processing for file access. Supported by Sybase, see documentation        
11207 Log the processing of text and image datatypes from remote servers. Supported by Sybase, see documentation        
11208 Prevents the create index and drop table statements from being transmitted to a remote server. sysindexes is updated anyway. Supported by Sybase, see documentation        
11209 When running "update statistics" on remote tables update only the rowcount. Supported by Sybase, see documentation        
11210 Disables Component Integration Services enhanced remote query optimization.        
11211 Prevents the drop table syntax from being forwarded to remote servers if the table was created using the create table at location syntax. Supported by Sybase, see documentation        
11212 Prevents escape on underscores in table names. Supported by Sybase, see documentation        
11213 Prevents generation of column and table constraints. Supported by Sybase, see documentation        
11214 Disables Component Integration Services recovery at start-up. Supported by Sybase, see documentation     Y  
11215 Sets enhanced remote optimization for servers of class db2.        
11216 For the session, disables enhanced remote optimization. Supported by Sybase, see documentation       Y
11217 For the server, disables enhanced remote optimization. Supported by Sybase, see documentation        
11218 Any query that is part of a declare cursor command, and that references proxy tables, is read only by default. Supported by Sybase, see documentation        
11220 Disables constraint checking of remote tables on the local server. This avoids duplicate checking. Setting this trace flag on ensures that queries are not rejected by the quickpass mode because of constraints. (spid) Supported by Sybase, see documentation        
11221 Disables alter table commands to the remote server when ON. This allows users to modify type, length, and nullability of columns in a local table without changing columns in the remote table. Use trace flag 11221 with caution. It may lead to tables that are “out of sync.” (spid). Supported by Sybase, see documentation        
11223 Disables proxy table index creation during create existing table or create proxy_table command execution. If this flag is set on, no index metadata is imported from the remote site referenced by the proxy table, and no indexes for the proxy table are created. This trace flag should be used with care and turned off when no longer necessary. (global) Supported by Sybase, see documentation        
11228 A 2762 error, "CREATE TABLE command is not allowed within multiple statement transaction" may be reported when executing a SQL INSERT..SELECT from proxy table mapped to a RPC. This traceflag has to be turned on to allow CREATE TABLE command in the remote procedure (for the session) 12.5.3. ESD 5 and 15.0 ESD 2      
11229 Use pre-12.5.3 behaviour to import statistics for proxy tables. Supported by Sybase, see documentation 12.5.3      
11231 CIS: Connections to remote servers are not disconnected and remain engine affinitied until the client session terminates. The connections can now be dropped and detached from an engine after executing a statement to the remote server by enabling this flag. Exceptions are when the statement is participating in cursor, transaction or stored procedure operations; or when ASE is in either HA failover or failback states. 15.0 ESD 2      
11232 A 2762 error, "CREATE TABLE command is not allowed within multiple statement transaction" may be reported when executing a SQL INSERT..SELECT from proxy table mapped to a RPC. This traceflag has to be turned on to allow CREATE TABLE command in the remote procedure (serverwide) 12.5.3. ESD 5 and 15.0 ESD 2      
11237 Only for proxy tables to Oracle, do not append unneeded "null clause" to "alter table modify" command 12.5.4 ESD 10      
11299 Allows connection information to be logged when a connection to a remote server fails. Supported by Sybase, see documentation        
11906 Informational messages from REORG will no longer be printed to the errorlog. 15.0 ESD 2      
12628 Data insertion into DOL tables having nonclustered index will be done with the index prepend mode splits disabled, in order to improve disk space utilization. 15.0 ESD 2   Y N
15302 When a subquery appears in the ON clause of an outer join query, the performance may not be efficient. ASE will do optimization for subquery attachment to achieve more favorable performance when turned on. 15.0 ESD 2      
15303 Possible performance improvement on a SELECT statement when a BIT column is involved in the WHERE clause. 15.0 ESD 2      
15322 Use 12.5 behaviour when assigning variables in combination with subqueries. 15.0.2 ESD 6      
15371 When set, bug fix for a sub-optimal plan is chosen when the query contains a subquery from an IF EXISTS clause. 12.5.4 ESD 10      
15381 When set, the warning message 307, "Index <index_name> specified as optimizer hint in the FROM clause of table <table_name> does not exist. Optimizer will choose another index instead." is disabled. 15.0.2 ESD 4      
15382 Disable "special OR strategy" (see release notes for the fine details) 15.0.2 ESD 2      
15556 Allow dump and load in ASE cluster edition with multiple instances active cluster edition      

SYBASE ASE - Connection String

ASE ODBC Driver and OLE DB Provider Migration Technical Whitepaper

ASE ADO.NET Data Provider

 

Standard

Data Source='myASEserver';Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

En spécifiant un fichier sql.ini :

DSURL='file://c:\sybase\ini\sql.ini?SQL_MIDOFF_OPC1';Database=myDataBase; UID=myUsername;PWD=myPassword;APP=myAppName;

 

 

Adaptive Server Anywhere OLE DB Provider

Standard

Provider=ASAProv;Data source=myASA;

 

TCP/IP

Provider=ASAProv.90;Eng=server.database_name;Uid=myUsername;Pwd=myPassword; Links=tcpip(Host=servername);

 

 

Sybase ASE OLE DB Provider

 

With Data Source .IDS file

Provider=Sybase ASE OLE DB Provider;Data source=myASE;

 

 

Adaptive Server Enterprise (ASE) alternative 1

Provider=Sybase.ASEOLEDBProvider;Srvr=myASEserver,5000;Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

Adaptive Server Enterprise (ASE) alternative 2

Provider=Sybase.ASEOLEDBProvider;Server Name=myASEserver,5000;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

Adaptive Server Enterprise (ASE) 12.5

Provider=Sybase.ASEOLEDBProvider.2;Server Name=myASEserver;Server Port Address=5000;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

 

Adaptive Server Enterprise (ASE) 15.0

Provider=ASEOLEDB;Data Source=myASEserver:5000;Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

Adaptive Server Enterprise (ASE) 15.0 alternative

Provider=ASEOLEDB;Data Source=myASEserver:5000;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

 

.NET Framework Data Provider for OLE DB

Provider=ASAProv;Data source=myASA;

 

 

 

Adaptive Server Enterprise ODBC driver

Adaptive Server Enterprise 15.0

Driver=={Adaptive Server Enterprise};app=myAppName;server=myServerAddress;port=myPortnumber; db=myDataBase;uid=myUsername;pwd=myPassword;

 

Standard Sybase System 12 Enterprise Open Client

Driver={SYBASE ASE ODBC Driver};Srvr=myServerAddress;Uid=myUsername;Pwd=myPassword;

 

Standard Sybase System 12.5 Enterprise Open Client

Driver={SYBASE ASE ODBC Driver};NA=Hostname,Portnumber;Uid=myUsername;Pwd=myPassword;

 

TDS based ODBC driver (from Sybase OCS 12.5)

Driver={Sybase ASE ODBC Driver};NetworkAddress=myServerAddress,5000;Db=myDataBase; Uid=myUsername;Pwd=myPassword;

 

Standard Sybase System 11

Driver={SYBASE SYSTEM 11};Srvr=myServerAddress;Uid=myUsername;Pwd=myPassword;Database=myDataBase;

 

 

 

Sybase SQL Anywhere (former Watcom SQL) ODBC driver

ODBC;Driver=Sybase SQL Anywhere 5.0;DefaultDir=c:\dbfolder\;Dbf=c:\mydatabase.db; Uid=myUsername;Pwd=myPassword;Dsn="";

 

 

 

.NET Framework Data Provider for ODBC

Driver=={Adaptive Server Enterprise};server=myServerAddress;port=myPortnumber; db=myDataBase;uid=myUsername;pwd=myPassword;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Utilisation de ddlgen SYBASE ASE

DDLGEN :

 

Le binaire est dans $SYBASE/ASEP/bin

Il faut positionner $SYBASE_JRE et $SYBROOT
ex :
export SYBASE_JRE=/export/home/sybase/DBMonitor/JDK1.4
export SYBROOT=/chemin/vers/distrib/ASE1502/
export PATH=$SYBASE/ASEP/bin:$PATH



Exemple de commande :

 

NOTE : le paramètre de nom '-N' accepte des wildards SQL : % !

NOTE2 : ne pas mettre d'espace entre le paramètre et sa valeur.

 

1- sauvegarde code de la table utilisateur "tloadconf"
SHELL>ddlgen -Usa -SmonDataserver -DmaBase -Ntloadconf -TU -Ofchier_out


2- Sauvegarde de la base "dbrepdev"
SHELL>ddlgen -Usa -SmonDataserver -DmaBase -TDB -Ndbrepdev -Odbrepdev_080609.sql


3- sauvegarde ddl des devices de la base maBase :
SHELL>ddlgen -Usa -SmonDataserver -DmaBase -TDBD -N%maBase% -OmaBase_devices.ddl

 

4- sauvegarde de la structure de la base sans aucuns objets :

SHELL>ddlgen -Usa -SmonDataserver -DmaBase -TDB -F%

 5- sauvegarde d'une procedure stockée maProc de la base maBase :

SHELL>ddlgen -Usa -SmonDataserver -DmaBase -TP -NmaProc -OmaProc.sql


où :
-D : base cible
-T: type de l'objet (si omit : database défaut du login)
-N : nom de l'objet
-O : fichier de sortie pour le code


Les types d'objets :

C       cache
D       default
DB     database
DBD   database device
DPD   dump device
EC     execution class
EG      engine group
EK      encrypted keys
GRP    group
I         index
KC      key constraints
L        login
LK       logical key
P        stored procedure
R        rule
RI        referential integrity
RO       role
RS        remote server
SGM     segment
TR        trigger
U         table
UDD     user-defined datatype
USR      user
V         view
WS       user-defined Web service
WSC     Web service consumer
XP        extended stored procedure

 

Articles tagged

Utilisation de Mount / Umount sous SYBASE ASE

MOUNT / UNMOUNT :

 

ATTENTION : la commande "unmount" efface les entrées de la base concernée et de ses devices dans le dataserver source !

C'est une méthode alternative pour copier / déplacer / migrer une base. Pratique et rapide.

0) vérifier la taille des pages des ASE et la compatibilité des OS.

1) on crée une base test_db dans le serveur source.

2) on démonte la base en indiquant le manifest_file :
RE-ATTENTION : j'insiste sur le fait que cela supprime toutes les informations du dataserver actuel !
SQL>unmount database test_db to "/chemin/vers/testdb_manifestFile"

2 bis) mettre la base en "quiesce" en générant le fichier "manifest" (cf : QUIESCE)

3) on copie les fichiers de device et le manifeste vers leur nouveau répertoire sur la destination.

4)remonter la base en indiquant le changement de chemin :
SQL>mount database all from "/chemin/vers/test_db_manifest.file"
using '/nouveau/chemin/vers/devices/test_data1' = 'test_data1',
'/nouveau/chemin/vers/devices/test_log1' = 'test_log1'

Note : pour retrouver les informations contenues dans le manifest file :
SQL> mount database all from '/nouveau"/chemin/vers/testdb_manifestFile" with listonly
... voir en shell : strings test_db_manifest.file

5) Remettre la base en ligne (avec migration automatique si besoin) :
SQL> online database test_db

Et voilà ! La base est disponible, avec ses devices.

Répartition des ressoures système sur SYBASE ASE

Répartition de l'utilisation des engines au niveau des logins (Limitation de l'activité)

 

Ex : Serveur SYBASE ASE tournant sur 3 engines, limitation sur 2 logins

Création des groupes d'engines :

sp_addengine 0,GR_Engine0

go

sp_addengine 1,GR_Engine2

go

sp_addengine 2,GR_Engine2

go

 

Ajout des classes d'execution :

sp_addexeclass ExecClass0,'MEDIUM',0,GR_Engine0

go

sp_addexeclass ExecClass2,'MEDIUM',0,GR_Engine2

go

 

Bind des logins dans les classes d'exécution :

sp_bindexeclass login0,'LG',null,ExecClass0

go

sp_bindexeclass login1,'LG',null,ExecClass2

go

 

Visualisation :

sp_showcontrolinfo   -- Visualisation du bind des logins

go

sp_showexeclass       -- Visualisation des classes d'exécution, groupes d'engines ainsi que les engines bindés

go

 

 

 

 

 

 

 

Charge CPU importante / Console en blocking mode / SYBASE ASE

Nous avons observer un problème sur une application qui faisait des dizaines de milliers de connexions / déconnexions sur notre serveur SYBASE ASE.

Cette utilisation engendrait un consommation massive de la CPU (user) du serveur SYBASE.

 

Le problème venait du fait que le serveur était démarré en mode blocking console. Chaque déconnexion écrivant une ligne dans l'errorlog (Pb de mauvaise gestion de la déconnexion), cela générait de la contention sur les connexions et donc une charge CPU très importante.

 

Nous avons passé le traceflag 4084 (Lien du solved case)  au niveau du RUNFILE (Attention à la version de SYBASE).

Celui-ci permet de forcer le serveur SYBASE à démarrer en mode console non bloquante.

 

Le problème est maintenant résolu

Volumétrie Tables / Indexes / Bases SYBASE ASE

 

Liste de la volumétrie des tables en version 12.5 :

 

Use mabase
Go
select     DateJour               = convert(datetime,convert(char(10),getdate(),103),103),    
Base = db_name(),  
Tables = Object_name(id),       
NombreLigne = max(rowcnt(doampg)) ,       
Reserved = (sum(reserved_pgs(id,doampg))+ sum(reserved_pgs(id, ioampg)))*2,        
Data = (sum(data_pgs(id, doampg)))*2,       
Indexes = (sum(data_pgs(id, ioampg)))*2  
from sysindexes        
where id > 100       
group by id        
order by object_name(id)

 

 

 

 

Liste de la volumétrie des tables en version 15 :

use mabase
go
select top 10 t.DateJour,t.Base,t.Tables,Nb_row=convert(varchar(10),sum(t.rwct)),Reserved=sum(t.reserved), Data=sum(t.data), Indexes=sum(t.indexes)
from (select  DateJour        = convert(datetime,convert(char(10),getdate(),103),103),
        Base            = convert(varchar(15),db_name()),
        Tables          = convert(varchar(20),object_name(id)),
        case when indid < 2 then (row_count(db_id(),id)) when indid > 1 then 0 end as rwct,
        reserved        = (reserved_pages(db_id(),id,indid))*(@@maxpagesize/1024),
        case when indid < 2 then (data_pages(db_id(),id,indid))*(@@maxpagesize/1024) when indid > 1 then 0 end as data,
        case when indid > 1 then (data_pages(db_id(),id, indid))*(@@maxpagesize/1024) when indid < 2 then 0 end as indexes
from sysindexes
where id > 100) t
group by t.DateJour,t.Base,t.Tables
order by Reserved desc

 

 

 

 

 

 

 

Utilisation de sp_passwordpolicy SYBASE ASE

 

En SYBASE ASE 15, l'option 'enable last login updates' est apparue sur la procédure système sp_passwordpolicy

Celle-ci met à jour la colonne lastlogindate sur la table syslogins de master. Cela peut provoquer une contention très importante sur la table syslogins. C'est le cas quand on se connecte avec le même login des milliers voire des millions de fois.

Pour éviter la mis à jour de la colonne lastlogindate, il faut lancer la commande suivante :

sp_passwordpolicy 'set','enable last login updates',0

 

Pour lister les options installées, taper :

sp_passwordpolicy 'list'

 

 

 

Audit sur SYBASE ASE

Cet article explique comment mettre en place l'audit et auditer telle table, tel login ...

 

Création des base de données

La base sybsecurity sert à l'outil d'audit. La base maudb_audit va permettre d'historiser les données d'audit.

  • create database sybsecurity
  • go
  • sp_dboption sybsecurity,"select into",true
  • go
  • sp_dboption sybsecurity,"trunc log",true
  • go

 

  • create database maudb_audit
  • go
  • sp_dboption maudb_audit,"select into",true
  • go
  • sp_dboption maudb_audit,"trunc log",true
  • go

 

Installation des tables d'audit :

  • use sybsecurity
  • go
  • sp_addaudittable audit_data01
  • go
  • sp_addaudittable audit_data02
  • go
  • sp_addaudittable audit_data03
  • go
  • use maudb_audit
  • go
  • select * into ta_audit from sybsecurity.dbo.sysaudits_01 where 1=2
  • go

 

Mise en place des threshold sur les segments d'audit :

Création de la procedure ps_audit_threshold

 use sybsecurity
go

IF OBJECT_ID('dbo.ps_audit_treshold') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.ps_audit_treshold
    IF OBJECT_ID('dbo.ps_audit_treshold') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.ps_audit_treshold >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.ps_audit_treshold >>>'
END
go
CREATE PROCEDURE dbo.ps_audit_treshold

AS
    BEGIN

        declare @audit_table_number int
/*
** Select the value of the current audit table
*/
select @audit_table_number = scc.value
from master.dbo.syscurconfigs scc, master.dbo.sysconfigures sc
where sc.config=scc.config and sc.name  = "current audit table"
/*
** Set the next audit table to be current.
** When the next audit table is specified as 0,
** the value is automatically set to the next one.
*/
exec sp_configure "current audit table", 0, "with truncate"
/*
** Copy the audit records from the audit table
** that became full into another table.
*/
if @audit_table_number = 2
    begin
        insert maudb_audit..ta_audit
            select sysaudits_02.event, sysaudits_02.eventmod, sysaudits_02.spid, sysaudits_02.eventtime, sysaudits_02.sequence, sysaudits_02.suid, sysaudits_
02.dbid, sysaudits_02.objid, sysaudits_02.xactid, sysaudits_02.loginname, sysaudits_02.dbname, sysaudits_02.objname, sysaudits_02.objowner, sysaudits_02.extr
ainfo from sysaudits_02
/*        truncate table sysaudits_02 */
    end
else if @audit_table_number = 3
    begin
        insert maudb_audit..ta_audit
            select sysaudits_03.event, sysaudits_03.eventmod, sysaudits_03.spid, sysaudits_03.eventtime, sysaudits_03.sequence, sysaudits_03.suid, sysaudits_
03.dbid, sysaudits_03.objid, sysaudits_03.xactid, sysaudits_03.loginname, sysaudits_03.dbname, sysaudits_03.objname, sysaudits_03.objowner, sysaudits_03.extr
ainfo from sysaudits_03
/*        truncate table sysaudits_03 */
    end
else if @audit_table_number = 1
    begin
        insert maudb_audit..ta_audit
            select sysaudits_01.event, sysaudits_01.eventmod, sysaudits_01.spid, sysaudits_01.eventtime, sysaudits_01.sequence, sysaudits_01.suid, sysaudits_
01.dbid, sysaudits_01.objid, sysaudits_01.xactid, sysaudits_01.loginname, sysaudits_01.dbname, sysaudits_01.objname, sysaudits_01.objowner, sysaudits_01.extr
ainfo from sysaudits_01
/*         truncate table sysaudits_03 */
    end
END
return
go
IF OBJECT_ID('dbo.ps_audit_treshold') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.ps_audit_treshold >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.ps_audit_treshold >>>'
go

 

sp_addthreshold sybsecurity,aud_seg_01,250,ps_audit_treshold
go
sp_addthreshold sybsecurity,aud_seg_02,250,ps_audit_treshold
go
sp_addthreshold sybsecurity,aud_seg_03,250,ps_audit_treshold
go
sp_addthreshold sybsecurity,aud_seg_04,250,ps_audit_treshold
go

 

 

 

Quelques exemples d'audit :

sp_audit 'select','all','matable','on'  :  audit les ordres 'select' lancés sur la table 'matable'

sp_audit 'all',login_name,'all','on'  :  audit le login login_name

sp_audit 'all',login_name,'all','off'  :  désactive l'audit sur le login login_name

 

Vérification des audits mis en place :

sp_displayaudit

 

Visualisation des tables d'audit :

 select eventtime,objname,loginname,audit_event_name(event) as event_name

from sysaudits_04

where objname in ('table1','table2','table3')

and eventtime > '2009/11/03'

 

select audit_event_name(event),

convert(varchar(20),eventtime,116),loginname,dbname,objname,

extrainfo

from sysaudits_03

where loginname='fmtb_dbo'
 

 

La colonne audit_event_name(event) renvoie le type de l'event (ex LOGIN pour la connexion. On obtient d'ailleurs l'IP du client dans la colonne extrainfo).