Download as pdf or txt
Download as pdf or txt
You are on page 1of 68

Tecnomatix System

Maintenance Guide
COPYRIGHT

Proprietary & Restricted Rights Notice

This software and related documentation are proprietary to Siemens Product Lifecycle Management
Software 2 (IL) Ltd.

© 2014 Siemens Product Lifecycle Management Software 2 (IL) Ltd.

Trademarks

Siemens and the Siemens logo are registered trademarks of Siemens AG. Tecnomatix is a trademark or
registered trademark of Siemens Product Lifecycle Management Software Inc. or its subsidiaries in the
United States and in other countries. All other trademarks, registered trademarks, or service marks
belong to their respective holders.
Adobe Reader is a trademark or registered trademark of Adobe Systems Incorporated.
Apache is a registered mark or trademark of The Apache Software Foundation or its subsidiaries in the
US and other countries.
AutoCAD is a registered mark or trademark of Autodesk, Inc. or its subsidiaries in the US and other
countries.
CATIA is a trademark or registered trademark of Dassault Systèmes or its subsidiaries in the United
States and/or other countries.
Firefox is a trademark or registered trademark of Mozilla Foundation.

Intel is a registered trademark of Intel Corporation.


Java is a registered trademark of Oracle and/or its affiliates.
Microstation is a registered mark or trademark of Bentley Systems, Incorporated or its subsidiaries in
the US and other countries.
Oracle is a registered mark or trademark of Oracle Corporation or its subsidiaries in the US and other
countries.
Pro/E, Creo, Creo Parametric, Windchill and Wildfire are trademarks or registered trademarks of
Parametric Technology Corporation or its subsidiaries in the United States and in other countries.
Siemens is a registered mark or trademark of Siemens Corp. or its subsidiaries in the US and other
countries.
TiCon is a registered mark or trademark of MTM or its subsidiaries in Germany and other countries.
Windows, Microsoft, Internet Explorer and Microsoft Office are trademarks or registered trademarks
of Microsoft Corporation.
Tecnomatix System Maintenance Guide

Contents
1 Overview ............................................................................................................................................................... 4
1.1 General Background ....................................................................................................................................... 4
1.2 Structure of this Guide.................................................................................................................................... 4
1.3 How to Use this Guide ................................................................................................................................... 4
2 Optimizing the Tecnomatix System ...................................................................................................................... 5
2.1 Network Optimization .................................................................................................................................... 5
2.1.1 Network Validations .............................................................................................................................. 6
2.2 File Server Optimization ................................................................................................................................ 6
2.2.1 File Server Validations ........................................................................................................................... 6
2.3 eMServer Optimization .................................................................................................................................. 7
2.3.1 Preliminary Validations ......................................................................................................................... 7
2.3.2 Tuning eMServer to Environment ....................................................................................................... 10
2.3.3 Permission Settings .............................................................................................................................. 12
2.3.4 Log Tuning........................................................................................................................................... 13
3 On-going Maintenance Procedures ..................................................................................................................... 16
3.1 eMServer ...................................................................................................................................................... 16
3.1.1 Monitoring ........................................................................................................................................... 16
3.1.2 Tecnomatix Logs.................................................................................................................................. 17
3.1.3 Cleanup ................................................................................................................................................ 17
3.1.4 Restart .................................................................................................................................................. 17
4 Database Optimization ........................................................................................................................................ 18
4.1 Building the Tecnomatix Instance ............................................................................................................... 18
4.1.1 Usage: .................................................................................................................................................. 18
4.2 Preliminary Validations ............................................................................................................................... 20
4.3 Setting the System to Maintenance Mode .................................................................................................... 21
4.4 Monitoring the Database .............................................................................................................................. 22
4.4.1 The Importance of Monitoring ............................................................................................................. 22
4.4.2 Maintaining the Database ..................................................................................................................... 22
4.5 Schema Statistics ......................................................................................................................................... 24
4.5.1 The Importance of Schema Statistics ................................................................................................... 24
4.5.2 How to Utilize Schema Statistics ......................................................................................................... 24
4.6 Index Rebuilding .......................................................................................................................................... 25
4.6.1 The Importance of Index Rebuilding ................................................................................................... 25
4.6.2 How to Rebuild Indexes ....................................................................................................................... 25
4.7 Schema Cleanup........................................................................................................................................... 26
4.7.1 The Importance of Schema Cleanups ................................................................................................... 26
4.7.2 The Importance of Backing Up Schemas ............................................................................................. 26

2
Tecnomatix System Maintenance Guide

4.8 Restart Database Instance (Optional) ........................................................................................................... 27


4.8.1 The Importance of Restarting the Database ......................................................................................... 27
4.8.2 How to Restart the Database ................................................................................................................ 27
5 Graphics Performance Tuning ............................................................................................................................ 28
5.1 Recommendations for Performance Optimization ....................................................................................... 29
6 Maintenance Table .............................................................................................................................................. 30
6.1 Fine-Tuning.................................................................................................................................................. 30
6.1.1 Database Analysis ................................................................................................................................ 31
6.1.2 Implementing Database Changes ......................................................................................................... 32
7 Appendix ............................................................................................................................................................. 33
7.1 Common Tasks............................................................................................................................................. 33
7.1.1 Killing Database Scheduled Jobs ......................................................................................................... 33
7.1.2 Killing Tecnomatix Sessions in the Database ...................................................................................... 33
7.1.3 Removing Tecnomatix Schemas in the Database ................................................................................ 33
7.1.4 Free Tablespaces TEMP, RBS and RBS_IMPORT ............................................................................. 33
7.1.5 Exporting/Importing a User Dump File ............................................................................................... 34
7.2 Statspack Initialization ................................................................................................................................. 36
7.3 Build_files.pl (Windows environment) ........................................................................................................ 37
7.4 Build_db.pl (Windows environment) ........................................................................................................... 50
7.5 Build_files.pl (UNIX environment) ............................................................................................................. 51
7.6 Build_db.pl (UNIX environment) ................................................................................................................ 63

3
Tecnomatix System Maintenance Guide

1 Overview
This document provides guidance to Tecnomatix system operators for performing on-going daily
maintenance to keep the system operating smoothly over the long run.
The Tecnomatix Maintenance Guide is written for Tecnomatix system operators/administrators, DBAs,
system administrators, and Tecnomatix support engineers.

1.1 General Background


The first phase of Tecnomatix implementation includes several steps, technical in nature, listed below:
1. HW configuration – a Tecnomatix representative, together with the customer, configures
the required hardware – refer to the Tecnomatix Administration Guide for more
information.
2. Installation – a Tecnomatix representative, together with customer, installs the
Tecnomatix system.
3. Optimization – after installation, the Tecnomatix system, especially the database,
should be analyzed to determine how to optimize usage in the actual working
environment.
4. Maintenance – a maintenance program is provided to ensure smooth running of
the Tecnomatix system.
Step 5 above, Maintenance, is based on the four preceding steps that are used to optimize the system and
prepare it for the on-going maintenance phase. With a good maintenance program, the Tecnomatix system
will run smoothly and deliver satisfactory performance.
Additional steps, not mentioned here, such as acceptance tests, are defined in the project. This guide
focuses on the steps that allow the administrator to achieve a comprehensive maintenance regimen.
The following aspects are not handled in this guide:
• Oracle 11G
• eMServer cluster solution

1.2 Structure of this Guide


The Tecnomatix System Maintenance Guide contains the following sections:
- Notes about system optimization – actions recommended during the early stages
of production, with detailed advice on optimizing the system to enhance
productivity.
- Setting up the system for maintenance – specifies the actions required before
beginning the maintenance phase.
- Notes about on-going maintenance procedures – once the system has been optimized,
procedures necessary to start a maintenance program.
- Appendices, including example scripts.
Use this guide to learn how to maintain the database instance, the eMServer and the eMSAgent. While
this document also contains some notes about basic operating system configuration, the main focus is on
Tecnomatix and not on external issues.

1.3 How to Use this Guide


Following the guidelines in this document, administrators can optimize their Tecnomatix system in the
early stages, from installation through the starting days of production.
With this Guide, they can also define a robust maintenance program for use in the
organization. The guide contains the following main sections:
o Chapter 2 explains the phases of optimization which administrators can refer to while installing
and running the system before production, including:
• Preliminary steps to validate that installation of the system were correctly implemented.
• Fine-tuning several system parameters to ensure close correlation to the environment.
o Chapters 3-5 describe a large range of maintenance procedures, including:
• Setting up the system for maintenance mode
• Procedures for on-going maintenance
• Maintenance tables summary
This guide explains basic optimization and maintenance procedures; however, administrators should
be experienced in IT issues in order to provide effective system optimization.
It is highly recommended to implement database optimization and maintenance with the help of a DBA.

4
Tecnomatix System Maintenance Guide

2 Optimizing the Tecnomatix System


As Tecnomatix (like many other enterprise systems) begins to become productive, you should optimize it
in the early stages of actual production. You can carry out some of the optimization tasks in advance, and
others you implement according to the field requirements. Read this section to learn about the major
steps recommended to optimize your company’s Tecnomatix system.

2.1 Network Optimization


Analyzing the network topology is the primary optimization issue facing administrators. This is necessary
to ensure that the network complies with the planned Tecnomatix topology in order to prevent network
bottlenecks. In some cases it may be necessary to request certain modifications to the organization’s
network to ensure optimized Tecnomatix topology.

DCOM ports – this is a range of ports used by DCOM. The default range is 49152-65535 for Windows Vista
and Windows Server 2008 and 1025-5000 for earlier versions of Windows. The port range can be changed
(and reduced to a smaller number of ports) by the system administrator.

5
Tecnomatix System Maintenance Guide

2.1.1 Network Validations


The following checklist can aid you in establishing the necessary validations for your network:

Item Details √
Network topology
Servers database server and the eMServer are recommended to be placed on a
LAN with an excellent, dedicated full duplex network connection of at
least 100 Mbit.
File server is recommended to be placed near the clients if possible. If
there are several client sites, you may place several file servers, one on
each site, and synchronize between them. If this is not possible, you may
place the file server in the data center.
License server is recommended to be placed near the clients if possible. If
not, try to place it at a location that offers a good connection to the client
sites. Web and Vis stream servers are recommended to be placed on the
data center and on one machine (one machine due to
3D streaming access possibilities both from the outside and inside
the organization).
Clients In general, clients can be placed on the LAN and the WAN with a minimum
of 10 MBit dedicated full duplex network connection.
It is highly recommended to put the clients inside the firewall due to
DCOM protocol problems.
Other components Check the network to ensure that there are no components that may cause
potential bottle necks, such as NAT translators routers, firewalls between
networks, etc.
Domain issues
Workgroup It is recommended to work with domains and not workgroups, however it is
possible to work with workgroups as follows: Should have the same users
and passwords on the server and on the clients.
Domains o It is recommended to put all users and machines on the same domain;
however, if this is not possible, you can use trusted domains.
o In some cases the domain name seen from the machine is an alias to
the real domain – make sure the alias points to the correct domain.

2.2 File Server Optimization


The file server acts as the host machine for all graphic components (.co libraries) and all central eBOP
files (.ppj, .ppd, .ppv, .ppc). The folder containing these files, called the System root, serves as a shared
folder for all eMPower users.
The only optimization/tuning issue for this server is the need to run a short validation process that
ensures that the system is ready for productive use, as described below.

2.2.1 File Server Validations


Use the following checklist for this process:
Item Details √
Spec
Disk space Check that there is enough disk space to host .co eBOP files. For
example, 15 GB per average car project (assuming there are no shared
components).
Network connectivity Ping:
- From the file server to all eMServers.
- From the file server to all clients.
- From each eMServer to the file server.
- From each client to the file server.
Ping time should be of average duration.
Machine OS Can host both Unix (in case

6
Tecnomatix System Maintenance Guide

Item Details √
Robcad is used) and Windows files. It is recommended that the OS
directly hosts Unix and NT without a mediator (such as Samba),
however, using a mediator is possible with specific settings (for more
details consult Tecnomatix support).
System root
Sharing The System root directory is shared, read/write for all Tecnomatix users.
Mapped drive Mapped drives can be used
UNC format UNC is fully supported.
Folder structure Make sure that:
- There is a library under the System root folder and this library
contains the .co folders.
- The System root folder resides under the mapped drive (if one
was used).
- For better performance of import and export, place all PPJ/PPD/XML
files under the System root.
From the client Check that the client can “see” the System root with its exact path and
that the client can perform import/export with the current System root.
From the eMServer Check that the eMServer can “see” the System root with its exact path.
System root location It is recommended to locate the System root in a central file server close
to the database and the eMServers.

2.3 eMServer Optimization


The Tecnomatix application server (eMServer) is responsible for most of the business logic of the
system. Since all client requests are handled in this tier, it must be configured precisely.

Though there are not many configuration parameters, it is important nevertheless to exercise
careful monitoring of this layer.
The server is built on top of COM+ with one major component, the eMServer. The dllhost.exe serves as
the eMServer process.
The eMSAgent is a special service that supplies the notification mechanism.

2.3.1 Preliminary Validations


Use the checklist below to make sure you optimize the system with the correct parameters. The following
table describes the eMServer validation checklist:

Item Details √
Connectivity
DB connectivity Tnsping SID is OK.
DB connectivity Sqlplus <user>/<user password>@<SID>is OK.
File server connectivity
Ping the file server (in case the file server is not located in the
eMServer).
Clients connectivity Perform a sample ping to a number of clients.
Registry entries
HKEY_LOCAL_MACHINE\ Check that:
SOFTWARE\Oracle\ o DEFAULT_HOME=<the Oracle client home name used by
all_homes the eMServer>
o Last_home=<the required home id>
HKEY_LOCAL_MACHINE\ Check that
SOFTWARE\Oracle \homex - NLS_LANG value matches the format in the database.
- ORACLE_HOME_NAME matches the Oracle client home name.
From version 9.1.1 and onwards, the Oracle Database can be
configured to store native UTF8 characters. In this case the Oracle
Client must have the same settings as the eMServer regional settings
and the client application. For more information, refer to the

7
Tecnomatix System Maintenance Guide

Item Details √
Tecnomatix Admin Guide.
ORACLE_HOME matches the path for the Oracle client installation.
HKEY_LOCAL_MACHINE\ Check that:
SOFTWARE\Tecnomatix\ Current version = <the installed version number>
eMplanner
HKEY_LOCAL_MACHINE\ Check that:
SOFTWARE\Tecnomatix\ FileSystemRoot=<the correct path for the system root with the
eMplanner\database correct letters>
HKEY_LOCAL_MACHINE\ Check that:
SOFTWARE\Tecnomatix\ CnfgFolder=<path to the correct folder, the default is the initData
eMplanner\settings folder under ..\Tecnomatix\.
HKEY_LOCAL_MACHINE\ Check that:
SOFTWARE\Tecnomatix\ (Default)=<ClientServer or Server>
eMplanner\setuptype
HKEY_LOCAL_MACHINE\ Check that:
SOFTWARE\Tecnomatix\ License Dir = <the correct path for the license files>
License
HKEY_LOCAL_MACHINE\ If you are unable to connect to the database via the eMS Administration
SOFTWARE\\Microsoft\MS tool, check the following registry entries:
DTC\MTxOCI "OracleXaLib"="xa80.dll"
"OracleSqlLib"="SQLLib80.dll"
"OracleOciLib"="oci.dll"

Component services\com+\eM-Server properties


Security tab Check that the following default values are intact:
- Authorization is unchecked
- Security level = first radio button
- Authentication level=connect
- Impersonation level=Impersonate
Identify tab Log off mode is only available when using this user option. When this
user is used, verify that the correct domain and user name appear in the
User field, as follows: <domain name>\<login name>.
The user should be a domain user and administrator on the
eMServer machine.
Note: For Windows 7 and Windows 2008 this user option should
be used.
Activation tab Check that the default value is in use:
- Activation type is server application.
Queuing Not in use, everything is unchecked.
Advanced tab Check that:
- The number of minutes until idle shut down (dllhost maximum
idle time) is a reasonable value, which can be optimized according to
the common usage. For example, when there are 10-20 concurrent users
per eMServer, 30-60 minutes until idle time is reasonable.
- When DLLHOST is restarted on idle time a new ems.log is
created and all aborted transactions will be cleaned.
- Permission, disable, deletion, and changes are checked.
- All other items are not checked.
Component services\my computer properties
Default properties tab Check that:
Enabled distributed com on this computer is checked
Default authentication level is connect
Default impersonation level is identify
Default protocols Check that the default protocol is: TCP/IP
Options tab If you are having problems with transactions timeout you can adjust the
value (the default is 60 seconds). You can increase it or set it to 0. 0
disables transaction timeout, but may leave aborted transactions in the
system. Restarting DLLHOST cleans aborted transactions.
Start\run\DCOMCNFG
Default Security tab Set the correct permissions group in: Access, Launch and

8
Tecnomatix System Maintenance Guide

Item Details √
Configuration. The permission group should include all Tecnomatix
users.
For Access, set Allow access. For Launch, set Allow
launch. For Configuration, set according to your
organization’s policy.
Application\eMSAgent Check all tabs, paying special to the following:
properties - Location, the machine on which the agent runs. (In
future versions it will be possible to install the
eMSAgent separately).
- Security, with the correct permissions to allow launch
for Tecnomatix users from their client machines.
DBscripts folder
Verify that the files in the folder are the latest updates (including all
patches).
agent.log Open the log and search for errors or warnings.
eMS.log Open the log and search for errors or warnings.
Other eMS logs eMS log folder briefly inspect the other logs in the eMS log folder (you
can locate it using the ems_config.cfg) for any type of problems.
<x>_spool.txt logs briefly inspect these logs, located under the
..\Tecnomatix\..\dbscripts folder. These logs are generated by the eMS
Administration tool.
Event Viewer Search for any errors or warnings in the Microsoft Event Viewer logs:
Application log.
- System log
- Security log
ems_config file
Queue size Check queue size – it is recommended to limit this value in accordance
with the number of concurrent users multiplied by 200 (the average
number of notices per client).
For example: For a maximum of 10 concurrent users, set the queue
size to 2000 (10 x 200).
Check chunk size You may use this option on an import server (an eMServer dedicated
for large imports). Fragmentizing the import process into chunks. It is
recommended to set this when the eMS has insufficient memory to
handle the import in one transaction.
For a 1GB machine, chunk size of 10000 - 20000 is sufficient.
Connection pool size The number of open database connections for reuse. The default is 10,
but you may adjust this number to match the number of concurrent
users.
If you have an average of 20-30 concurrent users, you may have 30
connections for reuse.
Check database to verify that
connection string is correct
eMSAgent name Check the eMSAgent name, mainly to make sure that each agent has
its own, unique name (by default, the eMSAgent name is the machine
name where the eMSAgent was installed).
The existence of a non-unique name could cause a double subscription
and corrupt the AQ schema. Use the following steps to check that all
names are unique:
1. Login to eM-Planner from clients connected to different agents and
open projects on each client.
2. Sqlplus <schema_aq>/<schema password>@<SID>.
3. Select * from observing_agents.
4. The system displays all agents currently observing objects –
inspect this list to verify the uniqueness of the agents’ names.
5. Another possibility is to check all the ems_config files in all the
eMServers.

DBT_log Check that DBT_log is 0. Set DBT_log=1


only when there is a need to track SQL
calls from the eMServer.

9
Tecnomatix System Maintenance Guide

Item Details √
NOTE: Setting the above parameter to 1 may degrade performance of
the eMServer.
Trace_log Check that Oracle trace is 0. Set this to 1 only when you want to track
Oracle SQLs in the database to find the most problematic SQLs. This
is equivalent to setting the SQL_TRACE to TRUE in the init.ora.
Note: Setting the above parameter to 1 may degrade performance of
the database server.
Log file location Check the eMS log folder location to make sure that you have write
permissions on this folder.
No GUI update at import Check that: NoGUIupdateAtImport is set to 0.
In case of a dedicated Import server (one of the eMServers is used as
an import server only), it is recommended to set the
NoGUIupdateAtImport to 1.
General
Oracle client Make sure that Oracle client is installed under a folder located on a
path without spaces (i.e., c:\program files\oracle).
Tnsnames.ora Make sure that the correct tnsnames file is located under
..\network\admin or any other folder according to the registry. For
setting the tnsnames file see the Tecnomatix Administration Guide.
Sqlnet.ora Make sure that the correct sqlnet.ora file is located under
..\network\admin or any other folder according to the registry. For
setting the tnsnames file see the Tecnomatix Administration Guide
OS Tuning
Performance options/Virtual It is recommended to set the page file size to system managed .
memory
Performance Set the server to run on background services.
options/Background services
File and printer sharing for It is recommended to set this value for maximal data throughput for
Microsoft network properties network applications.

2.3.2 Tuning eMServer to Environment


After performing the eMServer installation validation, you must run the application and tune it for the
specific requirements of your productive environment. The actual steps required to tune the eMServer,
described below, are minimal since the OS handles most of the tuning issues. Normally, you perform
tuning tasks during the early stages of production, but it is possible to tune the eMServer even earlier, for
example, in cases when intensive on-site acceptance tests are being implemented.
While certain segments of the tuning process are handled on the OS level, you perform other parts at
the Tecnomatix level.
ems_config tuning
Use the eMS Administration tool to tune the following ems_config items:
- Agent_Q_size – During the validation phase, use the following rule-of-thumb calculation
to set the queue size:
200 x NOC - where NOC is the number of concurrent users per eMServer.
When deciding about the queue size, remember that severely limiting queue size may
cause user sessions to be killed. This may occur simply because too many notices have
activated the queue cleaner. Therefore, it is important to optimize the queue limit to
achieve a balance
between the likely number of notices in the queue compared to the amount of logged-in
users. You can determine this number with the rule-of-thumb calculation mentioned above
as your starting point, and by trial and error, as demonstrated in the following example:
1. For 10 concurrent users on the eMServer, the queue size limit should be
10x200=2000 notices. Use the eMS Administration tool to set the queue size limit to
2000.
2. Once the system is up and running, check the frequency of user sessions killed for no
reason as well as the eMSAgent process memory size. If the frequency of user session
kills
is high, double the queue size limit (to 4000 for 10 users, as if the average number
of notices per user is 400).
3. If the frequency of user sessions killed is very low, decrease the queue size until you
reach an optimum balance where user kills happen very seldom on the one hand and the

10
Tecnomatix System Maintenance Guide

queue does not significantly increase (i.e., eMSAgent process memory size remains
within acceptable range of 20-40 MB).
- chunk size – For a 1GB machine, chunk size of 10000-20000 is sufficient. This parameter is
only relevant for the import phase. NOTE: when the chunk size value is too small it may
affect the total time of the import (e.g., a chunk size of 3000 for a project with more than
300000 nodes)
Running processes configuration
Monitor other processes (not Tecnomatix processes) running on the eMServer machine to
determine whether they may be affecting server performance. To check this, use the Task
Manager with the following counters:
- Mem usage
- CPU usage
If any of these processes impose a heavy usage load, consult with your system administrator about
configuring the process for more efficient use, or kill it. In many cases, the anti-virus exacts a high
process load on the server in addition to the Tecnomatix processes. It is possible to reduce server load
by configuring the anti-virus to exclude Tecnomatix files (especially ems.log) from virus scanning.
Performance monitor counters
You can use the Microsoft performance monitor to detect basic problems occurring on the server
such as poor memory management or inefficient processes. It is required that you conduct at least
one week of monitoring on the productive environment in order to gather significant results that can
indicate where obstacles may exist.
In some cases, when you suspect the occurrence of a certain problem, you may have to drill down on
some counters in order to acquire more details. This process requires a week or two for completion.
To set the performance monitor counters and the log, consult your system administrator. For preliminary
monitoring, run the performance monitor for several days on a productive or test load. When running a
monitor for several days, take a sample every hour; when running a monitor for several hours, take a
sample every 30 seconds. In either case, use the following counters:
Performance object Counters Performance aspect being
monitored
Distribution transaction 1. Active transactions COM+ transactions.
coordinator 2. Transaction/sec Since the eMServer is a COM+
3. Aborted transactions/sec component it uses the transaction
4. Active transactions mechanism.
5. Committed transactions
6. Response time – Average
7. Response time – Maximum
8. Response time –
9. Minimum
10. Transaction/sec
Memory 11. Available bytes o 1-2 To monitor memory usage
12. Cache bytes o 3-4 To detect problems with
13. Committed bytes virtual bytes
14. Commit limit o 5-10 To monitor memory
15. Page faults/sec bottlenecks and memory leaks
16. Page reads/sec
17. Page writes/sec
18. Pages Input/sec
19. Pages output/sec
20. Pages/sec
Server 1. Bytes received/sec Another view of network
2. Bytes sent/sec throughput
3. Bytes total/sec
Network interface 1. Bytes received/sec Network throughput
2. Bytes sent/sec
3. Bytes total/sec
Network segment 1. % of net utilization Network usage.
Note: This counter requires
installation of network packet
protocol.

11
Tecnomatix System Maintenance Guide

Performance object Counters Performance aspect being


monitored
PhysicalDisk 1. % Disk read time o 1-2 To monitor disk usage
2. %Disk time o 3-4 To monitor disk bottlenecks
3. Avg. disk queue length
4. Current disk queue length Set the system for disk monitoring
as follows:
1. Open a CMD window
2. Type diskperf –y
3. Restart the server
4. To disable monitoring, type
diskperf –n
5. Restart the server

Note: Monitoring the disks may


affect performance slightly.
Process (all instances) 1. % Privileged time Resources exploited by each
2. % Processor time running process on the server
3. Virtual bytes
4. % User time
5. ID Process
6. IO Data bytes
7. Thread count
8. Handle count
9. Working set
Processor (all_instances or 1. % Processor time o 1 To monitor processor(s) usage
total_) 2. Interrupts/sec o 2 To monitor processor
bottlenecks
System 1. Context switches/sec o 1-2 to monitor processor
2. Processor queue length bottlenecks
3. Processes o 3-4 Overview of running
4. Threads processes

Analyze the performance monitor counters by checking their behavior, for example:
• If you notice that there is a constant increase in the amount of context switches/sec, check the thread
count to see if there is a correlation. If there is also an increase in the thread count, examine the
particular process with the rising threads. By detecting this process, you can implement the
appropriate course of action.
• If the network segment % of network utilization is more than 30% and the network throughput of
the server (total bytes/sec) is a high percentage of the network bandwidth, it may indicate a
possible bottleneck in the network.
• If the % of CPU time is high (more than 90%) and the average CPU queue length size is more than
2 and there are no high values on disks and the network, this indicates that more CPU power is
needed (accomplished by adding or replacing CPUs).
• If the pages/sec counter is more than 100, while there are less than 4MB available and the % of disk
time (for logical disks) for access of paging files is more than 70%, this may indicate a paging
problem due to lack of memory resources. This can be improved by adding more memory.
In case of one or more suspicious counters, expand your analysis to include more counters in order
to pinpoint the problem.

2.3.3 Permission Settings


- If necessary, you may set eMServer to logoff mode:
1. Go to Component services/eMServer Component properties/Identify tab.
2. Select this user.
3. Type in user name and password of a domain user who is an administrator on
the eMServer machine.
Note: When using Windows 7 or Windows 2008, the user should always be set
anyway.
- Set the eMSAgent security as follows:
1. Run the dcomcnfg tool.
2. Open the Security tab.

12
Tecnomatix System Maintenance Guide

3. Set the Access and Launch permissions for the group of permitted users (all Tecnomatix
clients connected to the current eMServer).
4. It is recommended to set the eMSAgent service to start automatically, freeing you from
the necessity of setting the launch permissions.

2.3.4 Log Tuning


The Tecnomatix system allows administrators to set the level of logs for the eMServer and for the
client. The PPConfigApp.exe tool, located under ...\Tecnomatix\em-planner folder, enables
Tecnomatix administrators to set the level of logging in order to analyze problems.

Default logging may provide preliminary information on errors and warnings; when encountering
specific problems, you may wish to set the logging to a more detailed level.
The default logs are located under c:\temp – however these logs may be written to any location
desired. You can set the log location from the eMServer Administration\eMS Log tab or directly from
the ems_config.cfg file (located under ..\Tecnomatix\em-planner\initdata).

NOTE: Changing the location of the ems_config.cfg file requires restarting the dllhost and the
eMSAgent service.

The PPConfigApp.exe writes the level of logging to the registry:


HKEY_LOCAL_MACHINE\SOFTWARE\Tecnomatix\em-
planner\settings: Log config
Log detail
Log type
The following steps demonstrate how to set the level of logging:

1. Run PPConfigapp.exe from the ..\Tecnomatix\em-planner folder.


2. Choose which log to configure and click Set.

NOTE: If you choose the Process Sensitive log, each time the eMServer component is restarted a new ems
log is created with the extension of the DLLHOST process id (i.e. ems1234.log).

13
Tecnomatix System Maintenance Guide

3. Choose Log Type and Log Detail and click Set for each one.

Log configuration:
eMServer log – the major log ems.log
Notification agent log – the emsagent log emsagent.log
Client log – the eM-Planner log located in eM-Planner.log client application
Process sensitive – if selected, each time the dllhost.exe is restarted a new ems log is created with the
dllhost.exe process ID (i.e. ems1234.log)

Log message content:


Each entry in the log has the following structure:
- Indication from where the message came
- The log type or the log package name
- The log detail or the log severity level
- The log message text
- The date and time when the message was reported
Log types:
The following table presents all types of log messages:

Initializes Package Name Description Registry Value


PF Foundation Low layer infrastructure package 04 00 00 00
PM ProcessModel Semantic Model 08 00 00 00
DG DataGate eMServer Data Gate (for import/export) 10 00 00 00
IE ImportExport DataGate interface 80 00 00 00
DB DbFoundation DB connectivity/services 00 01 00 00
APP No special package The Client Log 00 04 00 00
PU Util Basic service 02 00 00 00
PP No special package Applications Log 01 00 00 00
PA AppComponents Shared application components 20 00 00 00
PB AppBehavior Global Application behavior 40 00 00 00
details:
Log details level:
Level 1 (low level): this level is enabled by default
• ERROR: an error, which aborts the user action. Or fatal error.
• WARNING: dangerous action performed that could cause a real error later. However, the action was
not aborted.
Level 2:
• INFO: information message.
• TRACE: tracing message.

14
Tecnomatix System Maintenance Guide

Level 3 (high level):


• RUNUTS: very informational log, with step by step details (Caution: this type may greatly
increase the size of the log file), e.g., when importing a file, this level exposes the content
of the imported object.
Note: Adding additional log levels, especially RUNUTS, can significantly decrease performance.

15
Tecnomatix System Maintenance Guide

3 On-going Maintenance Procedures


When the system reaches on-going operations mode, it is necessary to maintain it by performing
small adjustments based on monitoring.
Above, we recommended settings to prepare the system for maintenance. This section describes
maintenance operations you must perform periodically for the eMServer and the database server.

3.1 eMServer
Detailed explanations of main Tecnomatix/eMServer objects follow. It is recommended to assign
eMServer maintenance to an engineer with system administrator skills.

3.1.1 Monitoring
It is good practice to perform minimal but regular monitoring on the eMServer in order to detect
problems and potential failures before they occur. Use the following tools:
- Microsoft built-in Performance monitor
- Microsoft built-in Event viewer
Using the Microsoft Performance monitor for counters
Run a constant monitoring log to make it easy to identify problems, while observing the following
counters:
Performance object Counters Instances When value reaches
Process - % Processor - Emsagent • When emsagent virtual bytes exceed 50 MB it is
time - dllhost#1 recommended to restart the emsagent service.
- Virtual bytes • When DLLHOST#1 exceeds 1GB, investigate the
- Thread count operation and check whether possible to run it
differently (i.e., large export of PPJ may be split
into several smaller PPD exports.
Memory - Available bytes • When page faults/sec exceed 4000, this indicates
- Page faults/sec memory management problem – requires more
- Pages/sec investigation.
• When pages/sec exceed 100 and available memory
is less than 4MB, research the paging activity and
consider adding more memory.
Processor - % Processor Total_ •If the avg. usage is more than 90% and the
time processor queue length is more than 2, find the
- Interrupts/sec process that is overloading the CPU and check
whether substituting a better CPU or adding
more CPUs is required.
•A dramatic increase from 1500 interrupts/sec
without correspondence to other system
counters may indicate a hardware problem.
System Context switches Constant increase in the number of context
switches/sec over the period of a week may indicate
the presence of too many threads in the system.
Server - Total bytes/sec • If the sum of total bytes/sec for all servers roughly
- Work equals maximum transfer rate of your network,
queue you should investigate the network throughput and
length segments.
• If the work queue value exceeds 4 there may be a
processor bottleneck. Continue to observe over
several intervals.
System - Processor • See Processor.
queue length for
multiple processors
Network - Segment % of • You must determine the threshold based on the
net utilization type of network you are running. For Ethernet
networks, for example, 30 percent is the
recommended threshold.
Note: for this counter, you will need to install
network packet protocol.

16
Tecnomatix System Maintenance Guide

Microsoft built-in Event viewer


Retrieve weekly logs from the Event viewer and pay special attention to errors and warnings
contained in the security and application logs.

3.1.2 Tecnomatix Logs


In your productive environment, logs are set to minimum; only warnings and errors are
displayed. Monitor the following logs on a weekly basis:
..\<eMServer log folder>\ems.log
..\ <eMServer log folder>\agent.log
Analyze warning or error messages that appear, and send any that may be unclear to Tecnomatix Customer
Support.

3.1.3 Cleanup
The ems.log em-planner.log and agent.log are not cleaned automatically, however each time:

• the DLLHOST is restarted, the ems.log is overwritten, any aborted COM+ transactions
of Tecnomatix are cleaned

• the eMSAgent is restarted, the agent.log is overwritten

• eM-Planner is restarted, the emplanner.log is overwritten

It is recommended to monitor your Tecnomatix log directory weekly and delete logs that have exceeded 200
MB, for the following reasons:
- they consume disk space
- writing to such files loads the system and degrades performance
Note: There is an option to configure the EMS log file with maximum size limit. When the file reaches the
limit, a new file is created. Refer to the Tecnomatix Administration Guide for further details.

3.1.4 Restart
It is highly recommended to reboot all servers at least once every month. In case this is not possible, use
the eMS Administration tool to restart the emsagent service and dllhost every week, as follows:
1) Open the eMS Administration tool.
2) S Use eMServer shutdown node..
This cleans the emsagent and dllhost sessions on the eMServer and shuts them down.
It is a good practice to run this procedure at night when users are not working.

17
Tecnomatix System Maintenance Guide

4 Database Optimization
The lowest tier in the Tecnomatix system is the database server and ultimately all events in the system pass
through it. Incorrect configuration of the database or lack of optimization will adversely affect users operating
the client applications in the higher tiers. Most database optimization requiring DBA competence is
implemented in the early stages of production. However, some of these tasks may also be handled later on.
Most organizations have dedicated database departments. Therefore, access to the database is achieved with
the assistance of the local DBA.
The database is installed and optimized by the DBA department. However, in many cases when no guidelines
have been set to optimize the Tecnomatix system database, the local DBA accepts the default settings.
This section relates to the most important database issues that may degrade performance when not optimized.

4.1 Building the Tecnomatix Instance


The requirements for building the Tecnomatix Instance are described also in Tecnomatix Administration
Guide.

Install Perl first - the Tecnomatix Oracle instance is created with Perl scripts The Oracle Sever installed
version is 11.2.0.3.

For Windows,see Appendix A.

For Unix,see Appendix B.

4.1.1 Usage:
# DB Instance Creation

perl -l <scripts_path>\build_files.pl <ORACLE_BASE> <ORACLE_HOME>


<ORACLE_SID> <MACHINE_NAME OR IP> <PORT>

perl -l <scripts_path>\build_db.pl <ORACLE_BASE> <ORACLE_HOME>


<ORACLE_SID>

For example:

# DB Instance Creation

perl -l D:\Oracle\scripts\Oracle11g\build_files.pl D:\Oracle


D:\Oracle\Ora11 ppdb my_server 1521

perl -l D:\Oracle\scripts\Oracle11g\build_db.pl D:\Oracle D:\Oracle\Ora11


ppdb

The following is a list of recommended database instance parameters (some of the memory parameters require
fine-tuning according to the size of the database and workload):

Parameter R&D Recommendations 11G

*.aq_tm_processes 1

*.compatible 11.2.0.3

*.control_files system dependent

18
Tecnomatix System Maintenance Guide

Parameter R&D Recommendations 11G

*.core_dump_dest system dependent

*.db_block_size 8192

*.db_cache_size system dependent

*.db_file_multiblock_read_count 8

*.db_files 1024

*.db_name system dependant

*.db_writer_processes 4

*.diagnostic_dest system dependant

*.fast_start_mttr_target 300

*.global_names FALSE

*.instance_name system dependant

*.java_pool_size 0

*.job_queue_processes 2

*.large_pool_size system dependent

*.log_buffer system dependent

*.max_dump_file_size 10m

*.open_cursors 400

*.optimizer_dynamic_sampling 2

*.optimizer_index_cost_adj 10

*.optimizer_mode CHOOSE

*.pga_aggregate_target system dependent

*.processes 500

*.query_rewrite_enabled FALSE

*.recyclebin off

*.remote_login_passwordfile EXCLUSIVE

*.service_names system dependant

*.session_cached_cursors 20

*.session_max_open_files 20

*.sga_max_size system dependant

19
Tecnomatix System Maintenance Guide

Parameter R&D Recommendations 11G

*.sga_target system dependant

*.shared_pool_size system dependent

*.star_transformation_enabled FALSE

*.streams_pool_size 0

*.timed_statistics TRUE

*.undo_management AUTO

*.undo_retention 600

*.undo_tablespace UNDOTBS1

*.utl_file_dir system dependant

*.workarea_size_policy auto

4.2 Preliminary Validations


It is necessary to verify if the database was installed correctly and according to Tecnomatix recommendations.
This task requires DBA assistance. You can also get valuable help from the Tecnomatix Administration Guide
and the following check list.

Item Details
Instance From each eMServer, open a command line window and type the following:
connectivity Tnsping <Tecnomatix instance name>
You should receive an OK message for each server.
Schema From each eMServer open a command line window and type the following:
connectivity - Sqlplus <schema name>/<schema
password>@<Tecnomatix instance name> is OK
- Sqlplus <schema name_aq>/<schema_aq
password>@<Tecnomatix instance name> is OK
- [optional, only for specific customers] Sqlplus
<schema name_bv>/<schema password>@<Tecnomatix
instance name> is OK
Instance List all the schemas in the Tecnomatix instance:
schemas list 1. Sqlplus system/<system password (DBA priviliges)>@<Tecnomatix
instance name>
2. SQL>Select username from all_users
3. All existing schemas are listed. Verify that the AQ schema is listed for
each main schema.
AQ cleanup Check that the ppq_table in the advanced queue schema is clean, as follows:
1. Sqlplus <schema>_aq/<schema password >@<Tecnomatix instance
name>
2. Select * from ppq_table – no rows should be returned as a result
3. Repeat step 2 several times until the ppq_table is empty.
List of table Verify that there is enough space for all the tables.
spaces Use the Tecnomatix Administration Guide to verify this. The following is a list of the
tables and their required space:
• AQ_DATA
• PP_DATA_128K
• PP_INDEX_128K

20
Tecnomatix System Maintenance Guide

Item Details
• PP_DATA_1M
• PP_INDEX_1M
• PP_DATA_10M
• PP_INDEX_10M
Table space All the above table spaces should be locally managed.
management
Table space Check table spaces’ initial size. All the tablespaces should be automatically
size and incremented. See the Tecnomatix Administration Guide.
increment
Table space Verify table space file locations.
files
Redo log Check redo log size. See the Tecnomatix Administration Guide.
Archive log If the system is operating in archive mode, check the archive directory size.
Running Retrieve the list of sessions running in the instance, as follows:
sessions 1. Sqlplus system/<system password (DBA priviliges)>@<Tecnomatix
instance name>
2. Select username,status from v$session
3. Check that all the sessions are relevant sessions
Instance Retrieve the Tecnomatix instance parameters and compare them to the values specified
parameters in the Tecnomatix Administration Guide.
To retrieve the parameters:
1. Sqlplus system/<sys password>@<Tecnomatix instance name>
2. Select name, value from v$parameter this lists all the instance parameters
and their values
Listener This task is done on the database server. Check listener stats as follows:
1. In a command line window type lsnrctl
2. Type stat - the listener status is displayed
3. Make sure that all relevant instances are on
NLS_LANG Recommended setting: AMERICAN_AMERICA.UTF8
Oracle patch Check that Oracle patch 11.2.0.3 is installed.
Do the following to retrieve this information:
- Sqlplus system/<sys password>@<Tecnomatix instance name>
Select comp_id, version, status from dba_registry

Disks Siemens Industry recommends storing database files on a RAID or storage subsystem:
Data and indexes in one volume
Control files and Redo logs in one volume
Archives in one volume
In all configurations, Siemens Industry recommends storing redo logs on the fastest
disks.

4.3 Setting the System to Maintenance Mode


• Running tasks on database scheduler:
o Rebuild indexes
o Schema statistics
o HWM reports
o Chained rows reports
o STATSPACK snapshots every day/week, in 11g the AWR reports are
saved for a week – no need in additional installation (however,
appropriate license is needed)
o Database backup:
 Hot backup, no database shutdown
• Incremental backup settings (backup
on daily basis the changes)

21
Tecnomatix System Maintenance Guide

• Full backup (backup database every


week)
 Cold backup, requires database shutdown (backup all
database files)

4.4 Monitoring the Database


4.4.1 The Importance of Monitoring
The database tables are constantly growing and subject to intensive use. This can lead to the following
problems over time:

• Row Migration: If an UPDATE statement increases the amount of data in a row so that the row no
longer fits in its data block, Oracle attempts to find another block with enough free space to hold the
entire row. If available, Oracle moves the entire row to the new block – this is called migrating a
row. Select queries on migrated rows perform more I/O, which can affect overall performance.
• Table Fragmentation: When you delete records from the database, the blocks that hosted them
remain. After many deletes, there is a high percentage of empty blocks relative to the entire table –
this can significantly degrade performance. All Oracle segments have an upper boundary containing
the data within the segment. This upper boundary is called the High Water Mark (HWM). The new
inserted rows can use this space again. The HWM is an indicator that marks the last block was ever
used in the table.
• Oracle Log Alerts: Oracle writes its own alerts. It is important to monitor these alerts periodically to
identify potential problems.
• Advanced Queue Items (optional): The Advanced Queue mechanism is part of the Tecnomatix
notification mechanism. This mechanism is critical for the Tecnomatix system. Siemens
recommends monitor it the Advanced Queue mechanism.

4.4.2 Maintaining the Database


4.4.2.1 HWM
The following tables may have HWM and a high degree of fragmentation:
• Main user.proxy
• Main user.rel_common
• Main user.usage_ex and other Meta tables such as part_ex, etc.
• Aq user.ppq_table
4.4.2.2 Fragmented Tables
Use the Oracle documentation on to facilitate identifying the fragmented tables. After locating a problematic
table, perform the following:
• Rebuild the problematic table.
• Rebuild the table's indexes.
4.4.2.3 Migrated Rows
To detect migrated rows, run the following SQL command:
select table_name,num_rows,chain_cnt,CHAIN_CNT/NUM_ROWS*100 pct_chained

from user_tables

where NUM_ROWS > 0

and CHAIN_CNT/NUM_ROWS*100 > 10

This SQL command retrieves all tables with more than 10% chained rows, based on schema analysis
statistics. Siemens recommends running this command once per week.

22
Tecnomatix System Maintenance Guide

4.4.2.4 Chained Rows


The table most likely to have a large amount of migrated rows is the main user.PROXY table. If a table
contains a high percentage of chained rows (50% or higher), Siemens recommends performing the following
steps:
• Rebuild the problematic table.
• Rebuild the table's indexes.
4.4.2.5 Log Alerts
Log alerts retrieve specific types of Oracle errors on a weekly basis from the Oracle log
alerts that are located under ORACLE_HOME/admin/<SID>/bdump.

The following example shows how this can be done in a Unix shell:

tail -200 ${ALERT_DEST}/alert_${SID}.log | egrep "ORA-255|ORA-255:|ORA-0255|ORA-214 |ORA-


214:|ORA-00214|ORA-270 |ORA-270:|ORA-00270|ORA-272 |ORA-272:|ORA-00272|ORA-600 |ORA-
600:|ORA-00600|ORA-1122 |ORA-1122:|ORA-01122|ORA-1578 |ORA 1578:|ORA-01578|ORA-1628
|ORA-1628:|ORA-01628|ORA-1630 |ORA-1630:|ORA-01630|ORA 1631 |ORA-1631:|ORA-01631|ORA-
1632 |ORA-1632:|ORA-01632|ORA-1650 |ORA-1650:|ORA 01650|ORA-1652 |ORA-1652:|ORA-
01652|ORA-1653 |ORA-1653:|ORA-01653|ORA-1654 |ORA 1654:|ORA-01654|ORA-1655 |ORA-
1655:|ORA-01655|ORA-1507|ORA-01507|Checkpoint not complete"`

Where ALERT_DEST refers to DIAGNOSTIC_DEST/<DBNAME>/<SID>/trace and


DIAGNOSTIC_DEST, SID, and DBNAME refer to the values of the spfile parameters.

Note: Only the last 200 lines in the alert file are checked.

This example can be used in Unix without any changes to track the Oracle errors that might be of interest.

If you retrieved errors, check the Oracle documentation for the meaning of each error and how best to deal
with it.

4.4.2.6 Advanced Queue Items (optional)


Advanced Queue Items retrieve basic information about Oracle Advanced Queue tables on weekly basis, as
follows:

• sqlplus <schema_aq>/<schema_aq password>@<SID>


• SQL> select count (*), usage_mask from observed_objects group by usage_mask;
• SQL> select count (*) from ppq_table;
• SQL> select * from observing_agents;
• Repeat these steps a few times every several minutes.
• If you indicate usage_mask 0, it indicates a problem (there notices observed by no emsagent) – contact
Siemens support.
• If PPQ_TABLE is not cleaned try to initialize the AQ as follows:
 Open a sqlplus session, to check which sessions are currently running:
sqlplus system/<system password>@<SID>
 Perform the following SQL statement, to get a list of all open eMSAgent sessions:
select serial#, sid, program, machine from v$session where program like 'eMSAgent%'
or program like 'emsagent%';
 Use the following SQL command to kill the sessions that remain open:
alter system kill session '<sid>,<serial#>';
 Use AdminConsole tool to reinitAQ:
Schema Administration->Schema Actions->Reset Advanced Queue

• Recheck the PPQ_TABLE. If it is still not empty, contact Siemens support.


• In step 4 if you notice that one or more of the emsagents are never shown in the observing_agents, check
their agent log files and their services status. For further assistance, contact Siemens support.

23
Tecnomatix System Maintenance Guide

4.5 Schema Statistics


4.5.1 The Importance of Schema Statistics
Oracle runs SQL statements (especially select commands) with the help of the Oracle optimizer. The
optimizer is based on database statistics generated by the schema analysis tool. After this analysis, the
database operates more efficiency, especially for tables with more than a 10% change in data. The main
contributors to data change are large imports or continual addition of data by users over time.

4.5.2 How to Utilize Schema Statistics


Select one of the following options to run the schema analysis periodically:
• It is important to check if statistics for the main schema are gathered correctly. The following SQLs can
help identify the updated statistics:
For tables:

Select trunc(last_analyzed),temporary,count(*) from user_tables group by

trunc(last_analyzed),temporary;

For indexes:

Select trunc(last_analyzed),temporary,count(*) from user_indexes group by


trunc(last_analyzed),temporary;

The temporary tables and indexes should not have any statistics.

• For schemas created with the eMServer Administration tool using the create new Oracle account option,
the following job (in bold) automatically runs every night at midnight (12.00am):
declare

jobno number;

begin

dbms_job.submit(

job => jobno,

what => 'DBMS_STATS.gather_schema_stats(''&ora_user'', method_opt => ''FOR


ALL INDEXED COLUMNS size 75'');',

next_date => to_date(trunc(sysdate))+1,

interval => 'trunc(sysdate) + 1');

commit;

end;

If you did not create the schema via the eMServer Administration tool, Siemens recommends
running this job at least once a week at night when there is minimum load on the system.
• For schemas that were not created with the eMServer Administration tool, there is no default schema
analysis . If you wish to run a periodic schema analysis, run the following PL/SQL blocks (in 10G this is
automatic):
-- Set all tables of the analyzed schema to be monitored
begin
dbms_stats.ALTER_SCHEMA_TAB_MONITORING('&ora_user',true);
end;

24
Tecnomatix System Maintenance Guide

-- Set the scheduler to run the schema analysis procedure nightly (12.00)
-- The option GATHER STALE forces the schema analysis to run only on tables with more than 10%
changes

declare
jobno number;
begin
dbms_job.submit(
job => jobno,
what => 'DBMS_STATS.gather_schema_stats(''&ora_user'', method_opt => ''FOR ALL
INDEXED COLUMNS size 75'' , options => ''GATHER STALE'');',
next_date => to_date(trunc(sysdate))+1,
interval => 'trunc(sysdate) + 1');
commit;
end;
/

The latter option is recommended. This is because it does not run on all the tables and saves CPU
resources.

4.6 Index Rebuilding


4.6.1 The Importance of Index Rebuilding
Deleting a large amount of records from the table can cause the table index tree to become ineffective. This is
because many indexes now point to empty records. Since queries on such tables also yield poor results, it is
important to rebuild the indexes periodically.

4.6.2 How to Rebuild Indexes


Run the following PL/SQL stored procedure on a monthly basis:

CREATE OR REPLACE PROCEDURE "SYS"."REBUILD_INDEX"

as

statement_idx VARCHAR2(4000);

CURSOR cur

IS

select 'alter index '||owner||'.'||index_name||' rebuild' from dba_indexes where temporary='N' and index_type
not in ('LOB','IOT - TOP') and owner<>'SYS';

BEGIN

open cur;

fetch cur into statement_idx;

while cur%found loop

execute immediate statement_idx;

fetch cur into statement_idx;

end loop;

END;

25
Tecnomatix System Maintenance Guide

This script rebuilds all indexes for all schemas within the instance.

If you want to rebuild the indexes only for a specific schema, replace the highlighted line with owner =
‘schema name’

4.7 Schema Cleanup


4.7.1 The Importance of Schema Cleanups
Oracle logs increase in size constantly, occupying greater amounts of disk space. To prevent logs from
consuming excessive disk space, it is essential to clean them at least once a week.
How to Clean Up Schemas

Delete all logs under the …<Oracle home folder>\<SID>\bdump , udump on a weekly basis.
If you are working with archive mode, make sure that the directory is not overflowing with archive files.

4.7.2 The Importance of Backing Up Schemas


While data redundancy is a crucial issue for database management in organizations, Tecnomatix does not
have a built-in solution to address this need. Therefore it is essential to determine a backup strategy.
How to Back Up Schema

There are several tools on the market for backing up databases. Oracle offers a backup solution, RMAN
(recovery manager), to backup and recover database information in an up to the last minute manner.
This utility can:
• Run a full backup (on any chosen period)
• Backup incrementally (on any chosen period)
• Recover easily and quickly up to the last minute
• Preserve constant disk space for archive logs
• Be scheduled to run automatically
• Integrate with external backup utilities
There are two methods of backups:

• Hot backup – the database is backed up on-line. Using Hot backup, you run the database in Archive
mode, in order to back up Redo log files as Archive files when they become full. Siemens recommends
the following:
 Run a weekly full backup – copy all the archive files.
 Run a daily incremental backup – only changes are copied.
 Maintain the archive directory at a constant size.
 To recover – load the full backup and the incremental backups up to date in order to
reinstate the database ‘up to the last minute’.
Database recovery time is very fast. The major disadvantage of the Hot backup method is that it may
overload the system.
• Cold backup – All database files are copied. This method requires database shut
down every time you perform a backup. But does not require implementing additional
procedures (as does the hot backup method).
Siemens recommends combining both Hot and Cold backup for a complete database backup
strategy.

See the backup script examples using RMAN in appendix 6.1.

Note: For database shutdown, first remove all Tecnomatix user sessions. You can do this by filtering
all the schemas in the eMServer Administrator tool in all the eMServer working with the instance,
and running truncate table dfsession.

26
Tecnomatix System Maintenance Guide

4.8 Restart Database Instance (Optional)


4.8.1 The Importance of Restarting the Database
You may want to restart the database instance/s periodically. This is done on several occasions, such as cold
backups and database changes.
Take special care when restarting database instances since there may be eMServers working with the
database.

4.8.2 How to Restart the Database


To shut down the database:

1. Make sure that there are no sessions.


2. Remove all eMServers sessions (dllhosts and emsagents).
3. SQLPLUS <schema>/<schema password>@<SID>
4. SQL> Truncate table DFSESSION – to clean eM-Planner sessions.
5. Repeat steps 3-4 for all schemas under the instance.
6. Now the database instance is ready for shutdown .

27
Tecnomatix System Maintenance Guide

5 Graphics Performance Tuning


The Performance tab includes parameters for specifying the level of display and graphics performance
quality.

The following table describes the performance parameters:

Parameter Description

Level of details Change the level of details shown in the Graphic Viewer between high
quality and improved performance by moving the slide bar to the desired
position.
Decrease level of details while When selected, the level of details is decreased when changing the view
changing view point point.
Cull parts with less than When selected, small details in the 3D data are hidden. Specify the size as
a percentage of the full display. Displaying fewer parts improves the
performance of the display. By default, this option is not activated.
Use background loading Enables the Graphic Viewer to display objects while prototype files are
being loaded. You configure the graphic display redraw rate in number of
seconds during background loading. By default, this option is activated.
Fixed frame rate Ensures a minimum frame rate (Frames Per Second) for animations. To
maintain the frame rate, the Direct Model viewer reduces the display detail
level if necessary. By default, this option is not activated.
Rendering mode The following options enable you to balance memory consumption against
system performance.

28
Tecnomatix System Maintenance Guide

Parameter Description

• Use OpenGL display lists – The default rendering technology.


• Use OpenGL buffer objects – This mode is slightly slower than
OpenGL display lists (depending on data objects) but consumes
significantly less memory.
• Disable use of OpenGL acceleration methods – For
troubleshooting only.
Memory Set the memory limit value (in MB) to define the largest amount of
memory that the application is allowed to consume. When the system
reaches the memory limit, it performs one or both of the following options
(depending on your selection):
• Optimizes the graphic scene by unloading unused shapes to
reduce memory consumption and avoid exceeding the limit.
• Displays a warning that the memory limit will be exceeded.
Note: If neither of these options is enabled, setting the memory limit has
no effect.

5.1 Recommendations for Performance Optimization


• In most cases, the default performance parameter settings are satisfactory. Only make changes if you
are encountering a specific problem.
• The Level of details is a userful if you are encountering a specific problem and require improved
system performance. If the performance is too slow, move the Level of details slider towards
"Speed" until you are satisfied with the performance and can accept the reduced quality. If the
graphics quality is not good enough, move the Level of details slider towards "Quality" until you are
satisfied with the graphics quality and can accept the reduced performance.
• To improve graphics performance you can turn on size culling. This option is not recommended if
components are fragmented into tiny shapes. You can also customize the cull size value to adjust the
balance between graphics performance and the amount of culled shapes.
• To reduce memory consumption:
 Change the Rendering mode from OpenGL Display Lists to OpenGL buffer
Objects.
 Move the Level of details slider towards "Speed" and/or turn on size culling. This
decreases the initial memory consumption required for loading large amounts of data
(because less shapes are loaded) and also improves performance. However, after a
long workflow in which you zoom-in to different regions of the 3D data, the shapes
that were not loaded at startup will be gradually loaded. You can combine increasing
“Speed” together with a memory limit to create a stable environment.
• Set the memory limit value (in MB) to define the largest amount of memory that the application is
allowed to consume.
 The memory value limit default value is 2000 MB. Reducing this value decreases the
likelihood that the system will crash due to having exceeded available memory
resources. However, this slows down performance when loading very large amounts of
data and executing zoom/pan operations.
 The memory limit can help only if the amount of data that can be unloaded without
affecting the functionality is large enough. If you do not have sufficient memory for
the initial load of the study, this option is not effective. If you managed to load the
data, performing zoom/pan unloads shapes (that become invisible) to load other shapes
that require visualization.
• When you reach the memory limit, the system performs one or both of the following:
 Optimizes the graphic scene by unloading unused shapes to reduce memory
consumption and avoid exceeding the limit.
 Displays a warning that the memory limit is about to be exceeded.
• When there is insufficient memory to load large data sets, Siemens recommends turning on the /3GB
Boot parameter. For details on configuring /3GB, refer to http://msdn.microsoft.com/en-
us/library/ff556232.aspx.

29
Tecnomatix System Maintenance Guide

6 Maintenance Table
The following table summarizes all the on-going maintenance actions.

Task Frequency Last performed Comment

Monitor table Weekly Consult Oracle documentation when


fragmentation to rebuild tables.

Monitor chained Weekly Consult Oracle documentation when


rows to rebuild tables.

Monitor log alerts Weekly Look for specific Oracle alerts that
may indicate database problems.

Monitor AQ tables Per demand When there are notification


problems such as delays of
notifications.

Monitor database Upon database Recommend to run in the morning


statistics (optional) team policy then at noon then in the evening so
that each report is based on 3
snapshots differences.

Schema analysis Weekly/Daily – If you run this process for STALE


depending on tables only, it is initiated by table
workload changes, not by weekly scheduling.

Rebuild Indexes Monthly

Cleanup Logs Recommended


weekly

Hot Backup Daily incremental Depends on your company’s backup


strategy.
Weekly full

Cold backup Depending on If backup is done less frequently


company policy than daily, it is recommended to
combine it with Hot backup -
depending on your company’s
backup strategy.

Restart (optional) As determined by Database server restart is only


the database group determined by your company’s
policy.

Siemens recommends performing Refresh Schema action through the Admin Console utility after rebuilding
tables/indexes:

Schema Administration -> Software Deployment -> Refresh Schema.

6.1 Fine-Tuning
This section describes basic database server tuning operations. Siemens recommends that you implement
them during the early stages of production when the database is already operative.

30
Tecnomatix System Maintenance Guide

In order to tune the database, first analyze the database behavior. Then, based on the results, implement
changes to improve performance.

6.1.1 Database Analysis


This section suggests a way to analyze database performance. Use for the results for implementing changes.
The database can be analyzed easily using Oracle STATSPACK statistics package, or, starting with Oracle 10,
AWR reports.
These tools enable you to analyze all database aspects. Using its report, you can decide which item in the
database to fine-tune.

Task Frequency Last performed Comment

Analyze Check when the last Run schema analysis if data grew significantly Recommended
schema schema analysis was since the time of the last analysis by running the to run at night
performed and determine following SQL: when system is
not overloaded.
the data growth since then.
DBMS_STATS.gather_schema_stats('ora_user',
Check the time of the last method_opt => 'FOR ALL INDEXED
analysis by running the COLUMNS size 75',cascade=>true);
following SQL statement:
When you setup the maintenance program, this
select LAST_ANALYZED script runs periodically according to data
growth.
from dba_tables;

Redo log Check the number of Increase the value of the initialization Database shut
buffer REDO BUFFER parameter LOG_BUFFER to 2M: down
ALLOCATION RETRIES
several times. If the 1. Shut down the database.
number is not close to zero 2. Change the init.ora parameter
LOG_BUFFER to 2M.
(3 or higher) increase the
3. Change the db_writer_process to
redo log buffer. 2.
4. Restart the instance.
If the database is using spfile instead of init.ora,
change the value in the spfile using "alter
system set log_buffer=2m scope=spfile;" and
restart the database.

Agent Check that PPQ_TABLE is If the PPQ_TABLE is not cleaned, do as


queue cleaned, as follows: follows:
cleanup
• sqlplus <AQ • Check if AQ_TM_PROCESSES parameter
schema>/<AQ schema value is 0.
password>@<SID> • If it is, change it by: alter system set
• Select * from AQ_TM_PROCESSES=1 and set init.ora
PPQ_TABLE to this value as well. If using spfile, use the
• Repeat the previous "alter system" command to change the
step several times and parameter.
verify that the To increase cleaning performance, check the
PPQ_TABLE is parameter JOB_QUEUE_PROCESSES value
cleaned. and increase it to at least2.
Redo log Check redo logs files size. The redo log size should be at least 100M.
files If the database is under heavy use, consider
500M redo logs.
CPU Check CPU utilization
under heavy load.
Memory Check memory usage
under heavy load.

31
Tecnomatix System Maintenance Guide

Task Frequency Last performed Comment

Load Check system load and


resources by using the top
command in UNIX and the
Performance monitor for
the Windows server.

6.1.2 Implementing Database Changes


After the database analysis, you will have a set of recommendations to implement on the database.
Implementing changes in the database is risky and requires detailed planning. The following table suggests a
way to implement database changes:

Operation Cost Effect Priority

Analyze schema Low Very high 1

Rebuild indexes Low+ High 2

Change DB parameters Medium High 3

Rebuild tables High Medium 4

This table shows an example of the required operations to fine-tune the database. These operations are
actually what we implement in order to improve a problematic item in the database.
The operations are prioritized as follows: The operation with the lowest cost (in terms of implementation) and
the highest beneficial effect receives the highest priority, and so on.

32
Tecnomatix System Maintenance Guide

7 Appendix

7.1 Common Tasks


This section describes a few common tasks that require special care in performing them, especially the ones
that are database-related.
These tasks are implemented upon demand, therefore they are not listed in the on-going maintenance
section.

7.1.1 Killing Database Scheduled Jobs


Sqlplus system/<system password>@<SID>
1. to list all the broken jobs
select job, what, broken from dba_jobs;

2. to stop the job


exec dbms_job.broken(job-id, true);
PL/SQL procedure successfully completed.
commit;
Commit complete.
3. to kill the broken job
exec dbms_job.remove(job-id);
commit;

7.1.2 Killing Tecnomatix Sessions in the Database


To kill Tecnomatix sessions in the database:

Sqlplus system/<system password>@<SID>


-- check for sessions in the database
select serial#, osuser, username,sid,status from v$session
-- kill emsagents and dllhosts sessions
alter system kill session '<sid>,<serial#>';

7.1.3 Removing Tecnomatix Schemas in the Database


1. sqlplus <schemaname_AQ>/<Schemapassword>@<SID>.
2. Drag the dropQ.sql file from the eM-Planner Installation/DBScripts directory to the command and click
enter. This will stop than drop the AQ queue objects
3. Exit the command.
4. sqlplus system/<system password>@<SID> and execute the following command:
drop user <schemaname_AQ> cascade;
5. Open command window and map it to the eM-Planner Installation/DBScripts directory.
Execute the following command:
DbUserAdmin.exe -dropUser -- -svr <database> -system <system user> -
systemPswd <system user pswd> -usr <user name> -usrPswd <user pswd>

7.1.4 Free Tablespaces TEMP, RBS and RBS_IMPORT


From time to time it is essential to free space in the non-data tablespaces (Temp, RBS,RBS_import).
In some cases it is necessary to free disk space on the server, while in others it is sufficient to release the
occupied space in the Oracle tablespace. When it is enough to free the tablespaces, just restart the database
instance in order to shrink the RBS, RBS_IMPORT and TEMP. Another option is to shrink the rollback
segments by alter rollback segment <segment name> shrink;

In case you need to free disk space on the database server, perform the following:
• SQLPLUS SYSTEM/<SYSTEM PASSWORD>@<SID>

33
Tecnomatix System Maintenance Guide

• Remove all Tecnomatix sessions from the database.


• Rebuilding TEMP tablespace
o Drop tablespace Temp as follows: DROP TABLESPACE <TEMP NAME>; COMMIT;
o Delete tablespace <TEMP NAME> file. The file location can be found by: SELECT
o NAME FROM V$TEMPFILE
o Create tablespace <TEMP NAME>, you can use the following example: CREATE
TEMPORARY TABLESPACE <TEMP NAME> TEMPFILE '<ORADATA>/temp01.dbf'
SIZE
200M REUSE AUTOEXTEND ON NEXT 640K EXTENT MANAGEMENT LOCAL;
while ORADATA is the database files location

• Rebuilding RBS tablespace


o Move all rollback segments related to RBS to be offline by: ALTER ROLLBACK
SEGMENT “<SEGMENT NAME>” OFFLINE;
o Drop tablespace RBS by: DROP TABLESPACE RBS; COMMIT;
o Delete RBS tablespace file/s, the file/s location can be found in the init.ora
o Create RBS tablespace, for example:
CREATE TABLESPACE RBS DATAFILE '<ORADATA>/rbs01.dbf' SIZE 500M REUSE
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 512K;
o Create rollback segments, for example:
CREATE PUBLIC ROLLBACK SEGMENT RBS01 TABLESPACE RBS
STORAGE ( OPTIMAL 4096K ); … CREATE PUBLIC ROLLBACK SEGMENT RBS20
TABLESPACE RBS STORAGE ( OPTIMAL 4096K );
o Move all new created rollback segments online, for example:
ALTER ROLLBACK SEGMENT "RBS01" ONLINE;… ALTER ROLLBACK SEGMENT
"RBS20" ONLINE;

• Rebuilding RBS tablespace


o Move rollback segment rbs_import offline by: ALTER ROLLBACK SEGMENT
“RBS_IMPORT01” OFFLINE;
o Drop tablespace RBS_import as follows: DROP TABLESPACE RBS_IMPORT; COMMIT;
o Delete RBS_Import tablespace file/s, the file/s location can be found in the init.ora
o Create tablespace RBS_Import, for example:
CREATE TABLESPACE RBS_IMPORT DATAFILE '<ORADATA>/rbs_import01.dbf'
SIZE 500M REUSE EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M;
o Create rollback segment rbs_import, for example:
CREATE ROLLBACK SEGMENT RBS_IMPORT01 TABLESPACE RBS_IMPORT
STORAGE ( OPTIMAL 100M );
o Move rollback segment rbs_import online, for example:
ALTER ROLLBACK SEGMENT "RBS_IMPORT01" ONLINE;

7.1.5 Exporting/Importing a User Dump File


To export a user dump file:
1. Remove all Tecnomatix user sessions related to the specific user that we would like to export from
the database. This can be done by clicking APPLY in the eMS Administration tool options tab.
2. Export: exp <schema name>/<schema password>@<SID> full=Y file=<file name to export>

To import a user dump file into an existing user:


1. Remove all Tecnomatix user sessions related to the user to whom to be exported from the database
– click APPLY in the eMS Administration Tool Options tab.
2. From ...\dbscripts, run the following: DbUserAdmin.exe -cleanUser -- -svr <database> -usr <user
name> -usrPswd <user pswd> to clean the user to whom to import.
3. Import: imp <schema name>/<schema password>@<SID> file=<file name to export> full=Y
4. Ignore the errors related to the Notices package during the import.
5. Once the import terminates successfully, from .\dbscripts run the following: DbUserAdmin.exe -
initAQ -
- -svr <database> -mainUsr <main user name> -mainPswd <main user pswd> -aqUsr
<AQ user name> -aqPswd <AQ user pswd>
6. Analyze the schema by:
sqlplus <schema name>/<schema password>@<SID>
SQL>exec sys.dbms_utility.ANALYZE_SCHEMA('<SCHEMA NAME>',

34
Tecnomatix System Maintenance Guide

'COMPUTE'); SQL>exec sys.dbms_utility.ANALYZE_SCHEMA('<SCHEMA


NAME>', 'COMPUTE',
method_opt => 'FOR ALL INDEXED COLUMNS'); SQL>Exit

Check if Index is a Candidate for Rebuild


The following example is a script that reveals whether the indexes of a given
schema are candidates for rebuild. This script is an example and not guaranteed to
work as is.

============================================================
= REM
REM rebuild_indx.sql
REM
REM Copyright (c) Oracle Software, 1998 - 2000
REM
REM Author : Jurgen Schelfhout
REM
REM The sample program in this article is provided for educational
REM purposes only and is NOT supported by Oracle Support
Services. REM It has been tested internally, however, and works as
documented. REM We do not guarantee that it will work for you, so
be sure to test REM it in your environment before relying on it.
REM
REM This script will analyze all the indexes for a given schema
REM or for a subset of schemas. After this initial analysis, the dynamic view
REM index_stats is consulted to see if an index is a likely
REM candidate for a rebuild or for a bitmap
index. REM
REM Database Version : 7.3.X and
above. REM
REM =============================================================

prompt
ACCEPT spoolfile CHAR prompt 'Output-file : ';
ACCEPT schema CHAR prompt 'Schema name (% allowed) : ';
promp
t
promp
t
prompt Rebuild the index when :
prompt - deleted entries represent 20% or more of the current
entries prompt - the index depth is more than 4 levels.
prompt Possible candidate for bitmap index :
prompt - when distinctiveness is more than 99%
prompt
spool &spoolfile

set serveroutput on
set verify off declare
c_name INTEGER;
ignore INTEGER;
height index_stats.height%TYPE := 0; lf_rows
index_stats.lf_rows%TYPE := 0; del_lf_rows
index_stats.del_lf_rows%TYPE := 0; distinct_keys
index_stats.distinct_keys%TYPE := 0; cursor c_indx
is
select owner, table_name, index_name
from dba_indexes
where owner like upper('&schema')
and owner not in ('SYS','SYSTEM');
begin
dbms_output.enable (1000000);

35
Tecnomatix System Maintenance Guide

dbms_output.put_line ('Owner Index Name % Deleted Entries Blevel


Distinctiveness');
dbms_output.put_line ('--------------- --------------------------------------- ----------------- ------ ---------------');

c_name := DBMS_SQL.OPEN_CURSOR;
for r_indx in c_indx loop
DBMS_SQL.PARSE(c_name,'analyze index ' || r_indx.owner || '.' ||
r_indx.index_name || ' validate structure',DBMS_SQL.NATIVE);
ignore := DBMS_SQL.EXECUTE(c_name);

select HEIGHT, decode (LF_ROWS,0,1,LF_ROWS), DEL_LF_ROWS,


decode (DISTINCT_KEYS,0,1,DISTINCT_KEYS)
into height, lf_rows, del_lf_rows, distinct_keys
from index_stats;
--
-- Index is considered as candidate for rebuild when:
-- - deleted entries represent 20% or more of the current entries
-- - the index depth is more then 4 levels.(height starts counting from 1 so > 5)
-- Index is (possible) candidate for a bitmap index when:
-- - distinctiveness is more than 99%
--
if ( height > 5 ) OR ( (del_lf_rows/lf_rows) > 0.2 ) then
dbms_output.put_line (rpad(r_indx.owner,16,' ') || rpad(r_indx.index_name,40,' ') ||
lpad(round((del_lf_rows/lf_rows)*100,3),17,' ') ||
lpad(height-1,7,' ') || lpad(round((lf_rows-distinct_keys)*100/lf_rows,3),16,' '));
end if;

end loop;
DBMS_SQL.CLOSE_CURSOR(c_name);
end;
/

spool off
set verify on

7.2 Statspack Initialization


Installing Statspack:
General description:
Create default tablespace to host statistics snapshot information, the tablespace should be created
under the instance that is in productive/test use.

The following example demonstrates how this is done:


Sqlplus sys/<sys password>@<SID>
SQL>
-- Create default tablespace named stats
create tablespace stats datafile ‘<Oradata folder>/stats01.dbf’ size 100M reuse
extent management local uniform size 128K;

-- Create perfstat user for


define default_tablespace=’stats’
define temporary_tablespace=’<the name of the temporary tablespace in the instance>’
@<oracle home>/rdbms/admin/spcreate

Uninstall Statspack:
General description:
Drop statspack user then drop statspack tablespace.

This can be done as follows:


Sqlplus sys/<sys password>@<SID>
SQL>
-- Drop statspack user

36
Tecnomatix System Maintenance Guide

@<oracle home>/rdbmd/admin/spdrop

-- Drop statspack tablespace (optional in case you do not want to use statspack anymore)
drop tablespace stats;

Using Statspack to Generate Statistic Reports:


General description:
Creating snapshots with perfstat user. It is recommended to take several snapshots during workload.
You can generate a report once you have enough snapshots.

This can be done as follows:


Sqlplus perfstat/perfsta@<SID>
SQL>
-- Create snapshots
exec statspack.snap
..
-- last snapshot
exec statspack.snap

-- Generate Statspack report, you are prompted to choose begin snapshot, end snapshot and report file name
<oracle home>/rdbms/admin/spreport

Cleaning snapshots:
General description:
You can cleanup statspack snapshots from time to time to control the backlog, limiting it to two weeks, for
example.

To do this follow the SQL below:


Sqlplus perfstat/perfsta@<SID>
SQL>
-- you will be prompted to choose the lowest and highest snapshots to establish the range for deletion -
-- All snapshots between the lowest and the highest will be deleted.
@<oracle home>/rdbms/admin/spurge

7.3 Build_files.pl (Windows environment)


# Set environment:

#------------------

#!C:\MKSNT/perl.exe

# Get command arguments:

# first argument: Oracle Base - directory under which Database admin and
oradata directories will be installed

# second argument: Oracle Home - directory under which Oracle RDBMS


software is installed

# third argument: Oracle SID - name of the database instance that will be
created

# fourth argument: IP - ip address of the machine on which the


installation is performed

use File::Path;

37
Tecnomatix System Maintenance Guide

# Use command arguments to assign values to local variables

local $oracle_home;

local $sid;

local $ip;

local $oradata_path;

local $small_database;

local $db_block_buffers;

local $pga_aggregate_target;

local $shared_pool_size;

local $shared_pool_reserved_size;

local $system_size;

local $large_tbs_size;

local $medium_tbs_size;

local $small_tbs_size;

local $large_ext_size;

local $medium_ext_size;

local $small_ext_size;

local $large_autoext_size;

local $medium_autoext_size;

local $small_autoext_size;

local $redo_log_size;

local $oracle_base = shift(@ARGV);

$oracle_home = shift(@ARGV);

$sid = shift(@ARGV);

$ip = shift(@ARGV);

$port = shift(@ARGV);

$oradata_path = shift(@ARGV);

local $admin_path = "${oracle_base}/admin/${sid}";

38
Tecnomatix System Maintenance Guide

$oradata_path = "${oracle_base}/oradata/${sid}" unless defined


($oradata_path);

# Unremark the following line for a small installation

#$small_database = "TRUE";

if (defined $small_database) {

# database parameters for small installation

$pga_aggregate_target = "50M";

$sga_target_size = "150M";

$system_size = "150M";

$large_tbs_size = "200M";

$medium_tbs_size = "150M";

$small_tbs_size = "100M";

$large_ext_size = "1M";

$medium_ext_size = "512K";

$small_ext_size = "128K";

$large_autoext_size = "10M";

$medium_autoext_size = "5120K";

$small_autoext_size = "1M";

$redo_log_size = "50M";

} else {

# The next 3 parameters are responsible for Oracle memory usage.

# Numbers are set for a 1G memory machine.

$pga_aggregate_target = "300M";

$sga_target_size = "400M";

$system_size = "300M";

$large_tbs_size = "500M";

$medium_tbs_size = "300M";

$small_tbs_size = "200M";

$large_ext_size = "10M";

$medium_ext_size = "1M";

39
Tecnomatix System Maintenance Guide

$small_ext_size = "128K";

$large_autoext_size = "100M";

$medium_autoext_size = "30M";

$small_autoext_size = "20M";

$redo_log_size = "100M";

# Create OFA-compliant directories for DB administration files

local $admin_base = "${oracle_base}\\admin";

local $admin_path = "${admin_base}\\${sid}";

mkdir "${admin_base}",777;

mkdir "${admin_path}",777;

mkdir "${admin_path}\\create",777;

mkdir "${admin_path}\\pfile",777;

mkdir "${admin_path}\\applog",777;

mkdir "${oracle_base}\\diag",777;

# Create OFA-compliant directory for database files

$oradata_path = "${oracle_base}\\oradata\\${sid}" unless defined


($oradata_path);

$oradata_path =~ tr/\\/\// ;

mkpath("${oradata_path}");

# Create a file into which success/failure messages will be written

rename
"${admin_path}\\create\\build_files.log","${admin_path}\\create\\build_fi
les.log.old";

local $logfile = "${admin_path}\\create\\build_files.log";

if (open(LOG_FILE, ">$logfile")) {

print "File $logfile created successfully\n";

40
Tecnomatix System Maintenance Guide

else {

print "Couldn't open file: $logfile\n";

# Build file to be placed in a default location for initSID.ora. The file


contains reference to an

# actual initialization file (IFILE = ...)

rename
"${oracle_home}\\database\\init${sid}.ora","${oracle_home}\\database\\ini
t${sid}.ora.old";

local $ifile = "${oracle_home}\\database\\init${sid}.ora";

if (open(OUT_FILE, ">$ifile")) {

print LOG_FILE "File $ifile created successfully\n";

else {

print LOG_FILE "Couldn't open file: $ifile\n";

print OUT_FILE "IFILE = \'${admin_path}\\pfile\\init.ora\'";

close(OUT_FILE);

# Build actual init.ora

rename
"${admin_path}\\pfile\\init.ora","${admin_path}\\pfile\\init.ora.old";

local $initora = "${admin_path}\\pfile\\init.ora";

if (open(OUT_FILE, ">$initora")) {

print LOG_FILE "File $initora created successfully\n";

else {

print LOG_FILE "Couldn't open file: $initora\n";

print OUT_FILE <<EOF;

41
Tecnomatix System Maintenance Guide

db_name = "${sid}"

instance_name = ${sid}

service_names = ${sid}

db_files = 1024

control_files = ("${oradata_path}\\control01.ctl",
"${oradata_path}\\control02.ctl", "${oradata_path}\\control03.ctl")

# Files Locations

diagnostic_dest= ${oracle_base}\\diag

utl_file_dir=${admin_path}\\applog

db_file_multiblock_read_count = 8

db_block_size = 8192

#sga_target replaces buffer_cache, shared_pool, large_pool and java_pool


sizes

sga_target = ${sga_target_size}

pga_aggregate_target=${pga_aggregate_target}

log_buffer = 1638400

max_dump_file_size = 10M

processes = 500

global_names = false

remote_login_passwordfile = exclusive

os_authent_prefix = ''

compatible = 11.2.0.3

open_cursors = 400

session_cached_cursors = 20

job_queue_processes = 2

aq_tm_processes = 1

optimizer_mode = CHOOSE

optimizer_index_cost_adj = 10

optimizer_dynamic_sampling = 2

query_rewrite_enabled=FALSE

42
Tecnomatix System Maintenance Guide

star_transformation_enabled=FALSE

fast_start_mttr_target=300

undo_management=AUTO

undo_retention=600 # 10 mins

undo_tablespace=UNDOTBS1

# For statspack

timed_statistics=TRUE

sec_case_sensitive_logon=FALSE

deferred_segment_creation=FALSE

recyclebin=off

EOF

close(OUT_FILE);

# Build Net configuration files: tnsnames.ora, listener.ora, sqlnet.ora

local $net8_path = "${oracle_home}\\network\\admin";

### Building tnsnames.ora

local $tnsnames = "${net8_path}\\tnsnames.ora";

if (open(OUT_FILE, ">>$tnsnames")) {

print LOG_FILE "File $tnsnames was successfully set\n";

else {

print LOG_FILE "Couldn't open file: $tnsnames\n";

print OUT_FILE <<EOF;

${sid} =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = ${ip})(PORT = ${port}))

43
Tecnomatix System Maintenance Guide

(CONNECT_DATA = (SID = ${sid})(GLOBAL_DBNAME = ${sid}))

EOF

close(OUT_FILE);

### Building listener.ora

local $listener = "${net8_path}\\listener.ora";

if ( -e $listener) {

print LOG_FILE "WARNING: File $listener skipped - file already


exists\n";

else {

if (open(OUT_FILE, ">$listener")) {

print LOG_FILE "File $listener created successfully\n";

else {

print LOG_FILE "Couldn't open file: $listener\n";

print OUT_FILE <<EOF;

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = ${ip})(PORT =


${port}))

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

44
Tecnomatix System Maintenance Guide

EOF

close(OUT_FILE);

### Building sqlnet.ora

local $sqlnet = "${net8_path}\\sqlnet.ora";

if (-e $sqlnet) {

print LOG_FILE "WARNING: File $sqlnet skipped - file already


exists\n";

else {

if (open(OUT_FILE, ">$sqlnet")) {

print LOG_FILE "File $sqlnet created successfully\n";

else {

print LOG_FILE "Couldn't open file: $sqlnet\n";

print OUT_FILE "SQLNET.AUTHENTICATION_SERVICES = (NTS)";

print OUT_FILE "SQLNET.EXPIRE_TIME = 1";

close(OUT_FILE);

# Building DB creation and customization scripts

local $credb_path = "${admin_path}\\create";

### Building SIDrun.sql - script to create DB

rename "${credb_path}\\${sid}run.sql","${credb_path}\\${sid}run.sql.old";

local $SIDrun = "${credb_path}\\${sid}run.sql";

if (open(OUT_FILE, ">$SIDrun")) {

print LOG_FILE "File $SIDrun created successfully\n";

else {

45
Tecnomatix System Maintenance Guide

print LOG_FILE "Couldn't open file: $SIDrun\n";

print OUT_FILE <<EOF;

spool ${credb_path}\\${sid}run.log

set echo on

connect sys/change_on_install@${sid} as SYSDBA

startup nomount pfile="${admin_path}\\pfile\\init.ora"

whenever sqlerror exit failure

CREATE DATABASE ${sid}

LOGFILE group 1 ('${oradata_path}\\${sid}_g1_m1.rdo',

'${oradata_path}\\${sid}_g1_m2.rdo') SIZE ${redo_log_size},

group 2 ('${oradata_path}\\${sid}_g2_m1.rdo',

'${oradata_path}\\${sid}_g2_m2.rdo') SIZE ${redo_log_size},

group 3 ('${oradata_path}\\${sid}_g3_m1.rdo',

'${oradata_path}\\${sid}_g3_m2.rdo') SIZE ${redo_log_size},

group 4 ('${oradata_path}\\${sid}_g4_m1.rdo',

'${oradata_path}\\${sid}_g4_m2.rdo') SIZE ${redo_log_size}

MAXLOGFILES 32

MAXLOGMEMBERS 2

MAXLOGHISTORY 1

MAXDATAFILES 254

MAXINSTANCES 1

EXTENT MANAGEMENT LOCAL

DATAFILE '${oradata_path}\\system01.dbf' SIZE ${system_size} REUSE


AUTOEXTEND ON NEXT 5M

SYSAUX DATAFILE '${oradata_path}\\sysaux01.dbf' SIZE ${system_size} REUSE


AUTOEXTEND ON NEXT 5M

DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '${oradata_path}\\temp01.dbf'


SIZE ${medium_tbs_size} REUSE AUTOEXTEND ON NEXT ${medium_autoext_size}
EXTENT MANAGEMENT LOCAL

UNDO TABLESPACE "UNDOTBS1" DATAFILE '${oradata_path}\\undotbs01.dbf' SIZE


${large_tbs_size} REUSE AUTOEXTEND ON NEXT 5M

CHARACTER SET UTF8

46
Tecnomatix System Maintenance Guide

NATIONAL CHARACTER SET UTF8;

spool off

exit

EOF

close(OUT_FILE);

### Building SIDrun1.sql - script to customize DB

rename
"${credb_path}\\${sid}run1.sql","${credb_path}\\${sid}run1.sql.old";

local $SIDrun1 = "${credb_path}\\${sid}run1.sql";

if (open(OUT_FILE, ">$SIDrun1")) {

print LOG_FILE "File $SIDrun1 created successfully\n";

else {

print LOG_FILE "Couldn't open file: $SIDrun1\n";

print OUT_FILE <<EOF;

spool ${credb_path}\\${sid}run1.log

set echo on

connect sys/change_on_install@${sid} as SYSDBA

--------------------------- Obsolete in 9i ---------------------------

-- No need to alter the default storage for the system tablespace,

-- uniform extent allocation is used.

-- No need to create RBS tablespaces, automatic undo is on.

-- No need to create the temp tablespace,

-- default temporary tablespace is created during database creation.

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

REM ********** TABLESPACES FOR TABLES **********

47
Tecnomatix System Maintenance Guide

CREATE TABLESPACE PP_DATA_128K DATAFILE


'${oradata_path}\\pp_data_128k_01.dbf' SIZE ${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${small_ext_size};

CREATE TABLESPACE PP_DATA_1M DATAFILE


'${oradata_path}\\pp_data_1m_01.dbf' SIZE ${medium_tbs_size} REUSE

AUTOEXTEND ON NEXT ${medium_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${medium_ext_size};

CREATE TABLESPACE PP_DATA_10M DATAFILE


'${oradata_path}\\pp_data_10m_01.dbf' SIZE ${large_tbs_size} REUSE

AUTOEXTEND ON NEXT ${large_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${large_ext_size};

REM ********** TABLESPACES FOR INDEXES **********

CREATE TABLESPACE PP_INDEX_128K DATAFILE


'${oradata_path}\\pp_index_128k_01.dbf' SIZE ${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${small_ext_size};

CREATE TABLESPACE PP_INDEX_1M DATAFILE


'${oradata_path}\\pp_index_1m_01.dbf' SIZE ${medium_tbs_size} REUSE

AUTOEXTEND ON NEXT ${medium_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${medium_ext_size};

CREATE TABLESPACE PP_INDEX_10M DATAFILE


'${oradata_path}\\pp_index_10m_01.dbf' SIZE ${large_tbs_size} REUSE

AUTOEXTEND ON NEXT ${large_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${large_ext_size};

REM ********** TABLESPACE FOR AQ TABLES **********

CREATE TABLESPACE AQ_DATA DATAFILE '${oradata_path}\\aq01.dbf' SIZE


${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

48
Tecnomatix System Maintenance Guide

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${small_ext_size};

REM ********** TABLESPACE FOR STATSPACK **********

CREATE TABLESPACE PERFSTAT_DATA DATAFILE


'${oradata_path}\\perfstat_data_01.dbf' SIZE ${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

\@${oracle_home}\\Rdbms\\admin\\catalog.sql;

\@${oracle_home}\\Rdbms\\admin\\catproc.sql;

\@${oracle_home}\\Rdbms\\admin\\catblock.sql;

\@${oracle_home}\\Rdbms\\admin\\catoctk.sql;

-- for sqlplus autotrace

\@${oracle_home}\\sqlplus\\admin\\plustrce.sql

\@${oracle_home}\\Rdbms\\admin\\utlxplan.sql;

GRANT SELECT, INSERT, DELETE, UPDATE ON plan_table TO public;

GRANT plustrace TO public;

--\@${oracle_home}\\Rdbms\\admin\\owminst.plb;

-- fixes a bug in Oracle 9.2.0

GRANT ANALYZE ANY TO SYSTEM;

GRANT SELECT ANY TABLE TO SYSTEM;

ALTER USER system IDENTIFIED BY manager;

connect system/manager

\@${oracle_home}\\sqlplus\\admin\\pupbld.sql

\@${oracle_home}\\sqlplus\\admin\\help\\hlpbld.sql helpus.sql;

spool off

exit

EOF

close(OUT_FILE);

49
Tecnomatix System Maintenance Guide

close(LOG_FILE);

7.4 Build_db.pl (Windows environment)

# Set environment:

#------------------

#!C:\MKSNT/perl.exe

# Get command arguments:

# first argument: Oracle Base - directory under which Database admin and
oradata directories will be installed

# second argument: Oracle Home - directory under which Oracle RDBMS


software is installed

# third argument: Oracle SID - name of the database instance that will be
created

local $oracle_base = shift(@ARGV);

local $oracle_home = shift(@ARGV);

local $sid = shift(@ARGV);

local $admin_path = "${oracle_base}\\admin\\${sid}";

local $credb_path = "${admin_path}\\create";

$ENV {'ORACLE_SID'} = "${sid}";

@command_args = ("${oracle_home}\\bin\\oradim","-new","-sid","${sid}","-
intpwd","change_on_install","-startmode","manual","-
pfile","${admin_path}\\pfile\\init.ora");

system(@command_args) == 0

or die "system @command_args failed: $?";

50
Tecnomatix System Maintenance Guide

@command_args =
("${oracle_home}\\bin\\sqlplus","/nolog","\@${credb_path}\\${sid}run.sql"
);

system(@command_args) == 0

or die "system @command_args failed: $?";

@command_args =
("${oracle_home}\\bin\\sqlplus","/nolog","\@${credb_path}\\${sid}run1.sql
");

system(@command_args) == 0

or die "system @command_args failed: $?";

@command_args = ("${oracle_home}\\bin\\oradim","-edit","-sid","${sid}","-
startmode","auto");

system(@command_args) == 0

or die "system @command_args failed: $?";

@command_args = ("${oracle_home}\\bin\\lsnrctl","start");

system(@command_args) == 0

or die "system @command_args failed: $?";

7.5 Build_files.pl (UNIX environment)


# Set environment:

#------------------

#!C:\MKSNTperl.exe

# Get command arguments:

# first argument: Oracle Base - directory under which Database admin and
oradata directories will be installed

# second argument: Oracle Home - directory under which Oracle RDBMS


software is installed

# third argument: Oracle SID - name of the database instance that will be
created

# fourth argument: IP - ip address of the machine on which the


installation is performed

51
Tecnomatix System Maintenance Guide

use File::Path;

# Use command arguments to assign values to local variables

local $oracle_home;

local $sid;

local $ip;

local $oradata_path;

local $small_database;

local $db_block_buffers;

local $pga_aggregate_target;

local $shared_pool_size;

local $shared_pool_reserved_size;

local $system_size;

local $large_tbs_size;

local $medium_tbs_size;

local $small_tbs_size;

local $large_ext_size;

local $medium_ext_size;

local $small_ext_size;

local $large_autoext_size;

local $medium_autoext_size;

local $small_autoext_size;

local $redo_log_size;

local $oracle_base = shift(@ARGV);

$oracle_home = shift(@ARGV);

$sid = shift(@ARGV);

$ip = shift(@ARGV);

$port = shift(@ARGV);

52
Tecnomatix System Maintenance Guide

$oradata_path = shift(@ARGV);

local $admin_path = "${oracle_base}/admin/${sid}";

$oradata_path = "${oracle_base}/oradata/${sid}" unless defined


($oradata_path);

# Unremark the following line for a small installation

#$small_database = "TRUE";

if (defined $small_database) {

# database parameters for small installation

$pga_aggregate_target = "50M";

$sga_target_size = "150M";

$system_size = "150M";

$large_tbs_size = "200M";

$medium_tbs_size = "150M";

$small_tbs_size = "100M";

$large_ext_size = "1M";

$medium_ext_size = "512K";

$small_ext_size = "128K";

$large_autoext_size = "10M";

$medium_autoext_size = "5120K";

$small_autoext_size = "1M";

$redo_log_size = "50M";

} else {

# The next 3 parameters are responsible for Oracle memory usage.

# Numbers are set for a 1G memory machine.

$pga_aggregate_target = "300M";

$sga_target_size = "400M";

$system_size = "300M";

$large_tbs_size = "500M";

$medium_tbs_size = "300M";

$small_tbs_size = "200M";

$large_ext_size = "10M";

53
Tecnomatix System Maintenance Guide

$medium_ext_size = "1M";

$small_ext_size = "128K";

$large_autoext_size = "100M";

$medium_autoext_size = "30M";

$small_autoext_size = "20M";

$redo_log_size = "100M";

# Create a file into which success/failure messages will be written

rename "db_files/build_files.log","db_files/build_files.log.old";

local $logfile = "db_files/build_files.log";

if (open(LOG_FILE, ">$logfile")) {

print "File $logfile created successfully\n";

else {

print "Couldn't open file: $logfile\n";

print LOG_FILE "sid is: $sid\n";

# Build file to be placed in a default location for initSID.ora. The file


contains reference to an

# actual initialization file (IFILE = ...)

###rename
"${oracle_home}/database/init${sid}.ora","${oracle_home}/database/init${s
id}.ora.old";

local $ifile = "db_files/init${sid}.ora";

if (open(OUT_FILE, ">$ifile")) {

print LOG_FILE "File $ifile created successfully\n";

else {

print LOG_FILE "Couldn't open file: $ifile\n";

print OUT_FILE "IFILE = \'${admin_path}/pfile/init.ora\'";

54
Tecnomatix System Maintenance Guide

close(OUT_FILE);

# Build actual init.ora

local $initora = "db_files/init.ora";

if (open(OUT_FILE, ">$initora")) {

print LOG_FILE "File $initora created successfully\n";

else {

print LOG_FILE "Couldn't open file: $initora\n";

print OUT_FILE <<EOF;

db_name = "${sid}"

instance_name = ${sid}

service_names = ${sid}

db_files = 1024

control_files = ("${oradata_path}/control01.ctl",
"${oradata_path}/control02.ctl", "${oradata_path}/control03.ctl")

# Files Locations

DIAGNOSTIC_DEST = ${admin_path}/diag

utl_file_dir=${admin_path}/applog

db_file_multiblock_read_count = 8

db_block_size = 8192

#sga_target replaces buffer_cache, shared_pool, large_pool and java_pool


sizes

sga_target = ${sga_target_size}

pga_aggregate_target=${pga_aggregate_target}

log_buffer = 1638400

max_dump_file_size = 10M

processes = 500

global_names = false

55
Tecnomatix System Maintenance Guide

remote_login_passwordfile = exclusive

os_authent_prefix = ""

compatible = 11.2.0.3

open_cursors = 400

session_cached_cursors = 20

job_queue_processes = 2

aq_tm_processes = 1

optimizer_mode = CHOOSE

optimizer_index_cost_adj = 10

optimizer_dynamic_sampling = 2

query_rewrite_enabled=FALSE

star_transformation_enabled=FALSE

fast_start_mttr_target=300

undo_management=AUTO

undo_retention=600 # 10 mins

undo_tablespace=UNDOTBS1

# For statspack

timed_statistics=TRUE

sec_case_sensitive_logon=FALSE

deferred_segment_creation=FALSE

recyclebin=off

EOF

close(OUT_FILE);

# Build Net configuration files: tnsnames.ora, listener.ora, sqlnet.ora

###local $net8_path = "${oracle_home}/network/admin";

### Building tnsnames.ora

56
Tecnomatix System Maintenance Guide

local $tnsnames = "db_files/tnsnames.ora";

if (open(OUT_FILE, ">>$tnsnames")) {

print LOG_FILE "File $tnsnames was successfully set\n";

else {

print LOG_FILE "Couldn't open file: $tnsnames\n";

print OUT_FILE <<EOF;

${sid} =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = ${ip})(PORT = ${port}))

(CONNECT_DATA = (SID = ${sid})(GLOBAL_DBNAME = ${sid}))

EOF

close(OUT_FILE);

### Building listener.ora

local $listener = "db_files/listener.ora";

if ( -e $listener) {

print LOG_FILE "WARNING: File $listener skipped - file already


exists\n";

else {

if (open(OUT_FILE, ">$listener")) {

print LOG_FILE "File $listener created successfully\n";

else {

print LOG_FILE "Couldn't open file: $listener\n";

57
Tecnomatix System Maintenance Guide

print OUT_FILE <<EOF;

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = ${ip})(PORT =


${port}))

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

EOF

close(OUT_FILE);

### Building sqlnet.ora

local $sqlnet = "db_files/sqlnet.ora";

if (-e $sqlnet) {

print LOG_FILE "WARNING: File $sqlnet skipped - file already


exists\n";

else {

if (open(OUT_FILE, ">$sqlnet")) {

print LOG_FILE "File $sqlnet created successfully\n";

else {

print LOG_FILE "Couldn't open file: $sqlnet\n";

print OUT_FILE "#SQLNET.AUTHENTICATION_SERVICES = (NTS)";

print OUT_FILE "SQLNET.EXPIRE_TIME = 1";

58
Tecnomatix System Maintenance Guide

close(OUT_FILE);

# Building DB creation and customization scripts

###local $credb_path = "${admin_path}/create";

### Building SIDrun.sql - script to create DB

rename "db_files/${sid}run.sql","db_files/${sid}run.sql.old";

local $SIDrun = "db_files/${sid}run.sql";

if (open(OUT_FILE, ">$SIDrun")) {

print LOG_FILE "File $SIDrun created successfully\n";

else {

print LOG_FILE "Couldn't open file: $SIDrun\n";

print OUT_FILE <<EOF;

spool db_files/${sid}run.log

set echo on

connect / as SYSDBA

startup nomount pfile="${admin_path}/pfile/init.ora"

whenever sqlerror exit failure

CREATE DATABASE ${sid}

LOGFILE group 1 ('${oradata_path}/${sid}_g1_m1.rdo',

'${oradata_path}/${sid}_g1_m2.rdo') SIZE ${redo_log_size},

group 2 ('${oradata_path}/${sid}_g2_m1.rdo',

'${oradata_path}/${sid}_g2_m2.rdo') SIZE ${redo_log_size},

group 3 ('${oradata_path}/${sid}_g3_m1.rdo',

'${oradata_path}/${sid}_g3_m2.rdo') SIZE ${redo_log_size},

group 4 ('${oradata_path}/${sid}_g4_m1.rdo',

'${oradata_path}/${sid}_g4_m2.rdo') SIZE ${redo_log_size}

MAXLOGFILES 32

MAXLOGMEMBERS 2

MAXLOGHISTORY 1

59
Tecnomatix System Maintenance Guide

MAXDATAFILES 254

MAXINSTANCES 1

EXTENT MANAGEMENT LOCAL

DATAFILE '${oradata_path}/system01.dbf' SIZE ${system_size} REUSE


AUTOEXTEND ON NEXT 5M

SYSAUX DATAFILE '${oradata_path}/sysaux01.dbf' SIZE ${system_size} REUSE


AUTOEXTEND ON NEXT 5M

DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '${oradata_path}/temp01.dbf'


SIZE ${medium_tbs_size} REUSE AUTOEXTEND ON NEXT ${medium_autoext_size}
EXTENT MANAGEMENT LOCAL

UNDO TABLESPACE "UNDOTBS1" DATAFILE '${oradata_path}/undotbs01.dbf' SIZE


${large_tbs_size} REUSE AUTOEXTEND ON NEXT 5M

CHARACTER SET UTF8

NATIONAL CHARACTER SET UTF8;

spool off

exit

EOF

close(OUT_FILE);

### Building SIDrun1.sql - script to customize DB

rename "db_files/${sid}run1.sql","db_files/${sid}run1.sql.old";

local $SIDrun1 = "db_files/${sid}run1.sql";

if (open(OUT_FILE, ">$SIDrun1")) {

print LOG_FILE "File $SIDrun1 created successfully\n";

else {

print LOG_FILE "Couldn't open file: $SIDrun1\n";

print OUT_FILE <<EOF;

spool db_files/${sid}run1.log

set echo on

connect / as SYSDBA

--------------------------- Obsolete in 9i ---------------------------

60
Tecnomatix System Maintenance Guide

-- No need to alter the default storage for the system tablespace,

-- uniform extent allocation is used.

-- No need to create RBS tablespaces, automatic undo is on.

-- No need to create the temp tablespace,

-- default temporary tablespace is created during database creation.

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

REM ********** TABLESPACES FOR TABLES **********

CREATE TABLESPACE PP_DATA_128K DATAFILE


'${oradata_path}/pp_data_128k_01.dbf' SIZE ${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${small_ext_size};

CREATE TABLESPACE PP_DATA_1M DATAFILE '${oradata_path}/pp_data_1m_01.dbf'


SIZE ${medium_tbs_size} REUSE

AUTOEXTEND ON NEXT ${medium_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${medium_ext_size};

CREATE TABLESPACE PP_DATA_10M DATAFILE


'${oradata_path}/pp_data_10m_01.dbf' SIZE ${large_tbs_size} REUSE

AUTOEXTEND ON NEXT ${large_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${large_ext_size};

REM ********** TABLESPACES FOR INDEXES **********

CREATE TABLESPACE PP_INDEX_128K DATAFILE


'${oradata_path}/pp_index_128k_01.dbf' SIZE ${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${small_ext_size};

CREATE TABLESPACE PP_INDEX_1M DATAFILE


'${oradata_path}/pp_index_1m_01.dbf' SIZE ${medium_tbs_size} REUSE

AUTOEXTEND ON NEXT ${medium_autoext_size}

61
Tecnomatix System Maintenance Guide

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${medium_ext_size};

CREATE TABLESPACE PP_INDEX_10M DATAFILE


'${oradata_path}/pp_index_10m_01.dbf' SIZE ${large_tbs_size} REUSE

AUTOEXTEND ON NEXT ${large_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${large_ext_size};

REM ********** TABLESPACE FOR AQ TABLES **********

CREATE TABLESPACE AQ_DATA DATAFILE '${oradata_path}/aq01.dbf' SIZE


${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL UNIFORM SIZE ${small_ext_size};

REM ********** TABLESPACE FOR STATSPACK **********

CREATE TABLESPACE PERFSTAT_DATA DATAFILE


'${oradata_path}/perfstat_data_01.dbf' SIZE ${small_tbs_size} REUSE

AUTOEXTEND ON NEXT ${small_autoext_size}

EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

\@${oracle_home}/rdbms/admin/catalog.sql;

\@${oracle_home}/rdbms/admin/catproc.sql;

\@${oracle_home}/rdbms/admin/catblock.sql;

\@${oracle_home}/rdbms/admin/catoctk.sql;

-- for sqlplus autotrace

\@${oracle_home}/sqlplus/admin/plustrce.sql

\@${oracle_home}/rdbms/admin/utlxplan.sql;

GRANT SELECT, INSERT, DELETE, UPDATE ON plan_table TO public;

GRANT plustrace TO public;

--\@${oracle_home}/rdbms/admin/owminst.plb;

-- fixes a bug in Oracle 9.2.0

GRANT ANALYZE ANY TO SYSTEM;

62
Tecnomatix System Maintenance Guide

GRANT SELECT ANY TABLE TO SYSTEM;

ALTER USER system IDENTIFIED BY manager;

connect system/manager

\@${oracle_home}/sqlplus/admin/pupbld.sql

\@${oracle_home}/sqlplus/admin/help/hlpbld.sql helpus.sql;

spool off

exit

EOF

close(OUT_FILE);

close(LOG_FILE);

7.6 Build_db.pl (UNIX environment)


# Set environment:

#------------------

#!C:\MKSNT/perl.exe

# Get command arguments:

# first argument: Oracle Base - directory under which Database admin and
oradata directories will be installed

# second argument: Oracle Home - directory under which Oracle RDBMS


software is installed

# third argument: Oracle SID - name of the database instance that will be
created

use File::Path;

use File::Copy;

local $oracle_base = shift(@ARGV);

local $oracle_home = shift(@ARGV);

local $sid = shift(@ARGV);

63
Tecnomatix System Maintenance Guide

local $oradata_path = shift(@ARGV);

local $admin_path = "${oracle_base}/admin/${sid}";

local $credb_path = "${admin_path}/create";

$ENV {'ORACLE_SID'} = "${sid}";

$ENV {'ORACLE_HOME'} = "${oracle_home}";

$ENV {'NLS_LANG'} = ".UTF8";

$ENV {'PATH'} = "${oracle_home}/bin:$ENV{'PATH'}";

# Create a file into which success/failure messages will be written

rename "db_files/build_db.log","db_files/build_db.log.old";

local $logfile = "db_files/build_db.log";

if (open(LOG_FILE, ">$logfile")) {

print "File $logfile created successfully\n";

else {

print "Couldn't open file: $logfile\n";

print LOG_FILE $ENV {'PATH'};

print LOG_FILE $sid ;

# Create OFA-compliant directories for DB administration files

local $admin_base = "${oracle_base}/admin";

local $admin_path = "${admin_base}/${sid}";

mkpath ("${admin_base}");

mkpath ("${admin_path}");

mkpath ("${admin_path}/create");

mkpath ("${admin_path}/applog");

mkpath ("${admin_path}/diag");

mkpath ("${admin_path}/pfile");

local $net8_path = "${oracle_home}/network/admin";

64
Tecnomatix System Maintenance Guide

# Create OFA-compliant directory for database files

$oradata_path = "${oracle_base}/oradata/${sid}" unless defined


($oradata_path);

mkpath("${oradata_path}");

rename
"${oracle_home}/database/init${sid}.ora","${oracle_home}/database/init${s
id}.ora.old";

rename
"${oracle_home}/database/PWD${sid}.ora","${oracle_home}/database/PWD${sid
}.ora.old";

rename "${admin_path}/pfile/init.ora","${admin_path}/pfile/init.ora.old";

rename "${net8_path}/listener.ora","${net8_path}/listener.ora.old";

rename "$${net8_path}/sqlnet.ora","${net8_path}/sqlnet.ora.old";

# copy files

copy ("db_files/init${sid}.ora",
"${oracle_home}/database/init${sid}.ora");

copy ("db_files/init.ora", "${admin_path}/pfile/init.ora");

copy ("db_files/listener.ora", "${net8_path}/listener.ora");

copy ("db_files/sqlnet.ora", "${net8_path}/sqlnet.ora");

# concatenate the new instance details into tnsnames.ora file

### Building tnsnames.ora

local $tnsnames = "${net8_path}/tnsnames.ora";

local $tnsnames_sid = "db_files/tnsnames.ora";

if (open(TNS_FILE, ">>$tnsnames"))

print LOG_FILE "File $tnsnames was opened successfully\n";

else {

print LOG_FILE "Couldn't open file: $tnsnames\n";

die('could not open tnsnames file');

65
Tecnomatix System Maintenance Guide

if (open (TMP_FILE, "$tnsnames_sid"))

print LOG_FILE "File $tnsnames_sid was opened successfully\n";

@lines=<TMP_FILE>;

print TNS_FILE "\n";

foreach (@lines)

print TNS_FILE $_;

else

print LOG_FILE "Couldn't open file: $tnsnames_sid\n";

die('could not open tnsnames tmp file');

close(TNS_FILE);

close(TMP_FILE);

##########################################

@command_args =
("${oracle_home}/bin/orapwd","file=${oracle_home}/dbs/orapw${sid}","passw
ord=change_on_install");

system(@command_args) == 0

or die "system @command_args failed: $?";

@command_args =
("${oracle_home}/bin/sqlplus","/nolog","\@db_files/${sid}run.sql");

system(@command_args) == 0

66
Tecnomatix System Maintenance Guide

or die "system @command_args failed: $?";

@command_args =
("${oracle_home}/bin/sqlplus","/nolog","\@db_files/${sid}run1.sql");

system(@command_args) == 0

or die "system @command_args failed: $?";

@command_args = ("${oracle_home}/bin/lsnrctl","start");

system(@command_args) == 0

or die "system @command_args failed: $?";

close(LOG_FILE);

67

You might also like