Navision Attain Architecture · 2009. 3. 11. · 1-2 Navision Attain Architecture 1.1 THE STRUCTURE...

101
Navision Attain Architecture

Transcript of Navision Attain Architecture · 2009. 3. 11. · 1-2 Navision Attain Architecture 1.1 THE STRUCTURE...

  • Navision Attain Architecture

  • Navision Attain Architecture

  • NOTICE

    This material is for informational purposes only. Navision a/s disclaims all warranties and conditions with regard to use of the material for other purposes. Navision a/s shall not, at any time, be liable for any special, direct, indirect or consequential damages, whether in an action of contract, negligence or other action arising out of or in connection with the use or performance of the material. This material is subject to change without notice.

    According to Danish copyright legislation it is against the law to reproduce any part of this material in any form or by any means without the permission of Navision a/s.

    The software described is supplied under license and must be used and copied in accordance with the enclosed license terms and conditions.

    COPYRIGHT NOTICE

    Copyright 2002 Navision a/s, Frydenlunds Allé 6, 2950 Vedbaek, Denmark. All rights reserved.

    TRADEMARKS

    The trademarks referenced herein and marked with either TM or are either trademarks or registered trademarks of Navision a/s or Navision Development a/s. However, the trademarks Microsoft, Windows, Windows NT, SQL Server and BackOffice are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

    Any rights not expressly granted herein are reserved.

    The trademarks of Navision a/s and Navision Development a/s are listed on this Web site: http://trademarks.navision.com

    The Arial font was used.

    Published by Navision a/s.

    Published in Denmark 2002.

    DocID: AT-310-SST-004-v01.00-W1W1

  • TABLE OF CONTENTS

    CHAPTER 1.

    INTRODUCTION 1-1

    1.1 The Structure of This Course 1-2

    1.2 The Navision Attain Client/Server Environment 1-3

    CHAPTER 2.

    INSTALLATION 2-1

    2.1 Possible Client/Server Installations 2-2

    2.2 Installing the Stand-Alone Client 2-7

    2.3 Installing Navision Server 2-9

    2.4 Program Properties 2-12

    2.5 Review Questions 2-20

    CHAPTER 3.

    THE STANDARD DATABASE 3-1

    3.1 What is Stored in the Database 3-2

    3.2 How it is Stored in the Database 3-3

    3.3 Setting Up The Database File 3-5

    3.4 Navision Database Features 3-6

    CHAPTER 4.

    THE SQL SERVER OPTION 4-1

    4.1 The Advantages of the SQL Server Option 4-2

  • TABLE OF CONTENTS

    4.2 The SQL Server Option – How it Works 4-3

    CHAPTER 5.

    THE NAVISION ATTAIN SECURITY MODEL 5-1

    5.1 A Security Overview 5-2

    5.2 An Introduction to Objects 5-4

    5.3 Limiting Access 5-5

    5.4 Setting Permissions 5-11

    5.5 Changing Your Password 5-14

    5.6 Setting Up Users with Windows Logins 5-15

    5.7 A Word about Licensing 5-16

    CHAPTER 6.

    FUNCTIONAL AREAS AND GRANULES 6-1

    6.1 The functional Areas in Navision Attain 6-2

    6.2 The Main Components of a Functional Area 6-4

    6.3 The Standard Relationships in a Functional Area 6-11

    6.4 Navigation Within a Functional Area 6-13

  • PREFACE

    This course is one of four modules in the Navision Attain® Programming course, which is part of the Navision Attain Solution Development training material. The course is intended to be used as self-paced study material and can be used separately or in connection with the other three modules in the course.

    When you have completed all four modules in the Navision Attain Programming course, you can take the Navision Attain Programming test to be certified as a Navision Attain Consultant in Programming.

    The following diagram shows all the courses in the Navision Attain® training curriculum with subject areas shown in gray:

  • Chapter 1.

    Introduction

    In this chapter, you learn about the Navision Attain® client/server architecture.

    The chapter contains a high-level overview of the architecture. Installing and setting up the client/server environment are discussed in the following chapters.

    This chapter covers:

    The Structure of This Course

    The Navision Attain Client/Server Environment

  • 1-2 Navision Attain Architecture

    1.1 THE STRUCTURE OF THIS COURSE

    This course is designed for anyone who wants to understand the architecture of Navision Attain. We recommend this course for anyone who will install and set up Navision Attain.

    This course will give you a basic understanding of the system architecture and the application architecture of Navision Attain. You will learn how the Navision Attain client connects to the server, as well as how to install the server and client components. In the last few chapters, you will learn how the application is designed.

    The following topics will be presented in this course:

    Chapter 1: Introduction – this chapter •

    Chapter 2: Client/Server Installation

    Chapter 3: The Standard Database

    Chapter 4: The SQL Server Option

    Chapter 5: The Navision Security Model

    Chapter 6: Functional Areas and Granules

    Each chapter contains an estimate of the time it takes to become familiar with the material that it contains. However, you should remember that this course is designed for self-study. Read the material as thoroughly as you can. Take as much time as you need to complete each exercise. If you need to go back and review a chapter, take the time to do so.

  • Introduction 1-3

    1.2 THE NAVISION ATTAIN CLIENT/SERVER ENVIRONMENT

    Navision Attain is a two-tier application. It consists of a Database Management System (DBMS) that resides on the server and a Graphical User Interface (GUI) that resides on each client. You can also configure the client to be a stand-alone installation, which means that the client functions as a server and a single client in one.

    Navision Attain has two database options: the standard Navision database and Microsoft’s SQL Server database.

    You can choose to use the database engine that is built into each client to run the standard Navision database as a stand-alone installation. It can also be purchased in a server version, which allows many clients to connect simultaneously to the same database. This server runs on a designated computer that all the clients communicate with.

    With the SQL Server Option, you install SQL Server on the server computer according to the guidelines specified by Microsoft and install Navision Attain on each client computer.

    Communication between the client and the server is done in one of the three ways. In the SQL Server Option, the client communicates with SQL Server through an ODBC connection. In the Navision Server option, the client can communicate with the server through the TCP/IP or NetBIOS protocols.

    Once the server and clients are configured, the user does not need to worry about the way the server and clients work together. It appears seamless to the user.

    Navision Application Server (NAS) is a middle-tier server that supports an n-tier architecture, which executes business logic without user intervention. With Navision Application Server, it is possible to communicate with external services.

    Navision Application Server acts as a client towards a database server and can act as a server for other services. When you start Navision Application Server, it opens a predefined database and executes C/AL™ code in a predefined codeunit.

    Navision Application Server can communicate with both Navision Server and the SQL Server Option in the same way as a Navision Attain client. Navision Application Server only supports Windows Authentication and automatically reconnects to the database server if there is a problem with

  • 1-4 Navision Attain Architecture

    the network.

    The Client

    As mentioned earlier, the Navision Attain client is basically responsible for the user interface, but it actually does much more. The client can connect directly to a standard database file without going through the server. This is the stand-alone setup that was mentioned earlier. The client is also responsible for executing all the business logic. The client reads objects from the database and is also responsible for running the objects and controlling their behavior. Most of the Navision Attain application runs on the individual clients.

    The Server

    If the clients do most of the work, what is left for the server to do? The standard server component of Navision Attain:

    Controls the number of users that can connect to the database at one time.

    Controls access to the data through locking.

    Keeps track of all the read and write transactions performed by every user.

    Returns data to each client, as requests are made.

    Performs all key-based filtering and calculates SumIndexFields.

    Caches data that can be requested again.

    This is not a complete list and is only designed to give you an idea of what the server does. Microsoft SQL Server also does all of these things. One thing that the standard server does that SQL Server does not, is keep track of different versions of the same record. We will discuss this in later chapters.

    Together, the client and the database server provide a seamless solution.

  • Chapter 2.

    Installation

    In this chapter, you will learn how to install the Navision Attain client and Navision Server.

    This chapter covers:

    Possible Client/Server Installations

    Installing the Stand-Alone Client

    Installing Navision Server

    Program Properties

  • 2-2 Navision Attain Architecture

    2.1 POSSIBLE CLIENT/SERVER INSTALLATIONS

    There are several ways that you can set up the client/server installation. In this chapter, we will talk about the various ways you can install the client and the server. We will also cover many of the most common mistakes that you should avoid.

    To ensure that this installation is a success:

    Bring the Navision Attain installation CD. •

    Bring the customer’s database.

    Bring the customer’s license.

    Test the installation, including the server and client connections.

    Cautions Regarding Any Installation

    These apply to the system where the database is being stored:

    Do not use compression utility programs such as DoubleSpace, Stacker or DriveSpace.

    Limit the number of services and programs that are run simultaneously - it slows down processing.

    Do not use Lazy Write, Swap Disk in OS/2, Smartdrive or other caching programs.

    Note

    Throughout this course it is assumed that you are using Windows 2000 as your operating system. However, please note that Windows NT can also be used as the operating system for the server, and Windows XP, Windows NT and Windows 98 can also be used as the operating system for the client.

    The Stand-Alone Client Installation

    The simplest setup that a customer can ask for is a one-user system. We call this a stand-alone client. This type of setup is very straightforward. You install the entire client on the computer that the user will be using. You must then replace the database.fdb file with the customized database you

  • Installation 2-3

    created for this customer. (Creating a customized database is discussed in another course.) Finally, replace the fin.flf license file that was installed with the executables with the customer’s license.

    The Standard Client/Server Installation

    This type of setup involves one standard server and several clients. Here, you should start by installing the stand-alone client as described above on the server computer. (This is the computer system that will run the server program.) By doing this first, you will assure that you have the customer’s database and license installed. The only difference here is that you might want to move the database file either to its own directory or to its own drive. In a later chapter, we will discuss the database file and how best to set it up.

    Once the client is installed on the server, you can run the server installation program. This is a completely separate installation program. For more information, see section 2.3 "Installing Navision Server". The installation program will prompt you for the location of the database and the license file. Select the customer’s database file and license. The installation program will also create a service and start the service at the end of the installation. It is this service that runs the Navision Attain standard server. Once the installation is complete, the server is up and running.

    The next step is to install Navision Attain on all the client computers. This installation is similar to the stand-alone client installation, except for some omissions. You should only install the client, (the Minimum installation - you do not need a database file). You do not need the customer’s database, as it resides on the server. However, you should still copy the customer’s license onto each client.

    Once the client is installed, the final step is to set up a shortcut on the desktop for the user and test it. The shortcut should include certain parameters, as in the following example:

    "C:\Program Files\…\fin.exe"

    servername=MyServer,nettype=TCP

    In this example, servername specifies the name of your Navision Server, and nettype specifies the protocol being used. By putting these parameters directly into the shortcut, the settings will not be lost and the user only needs to remember their password.

    The final step is to double-click the shortcut and test the connection. If an error occurs, it is usually because the client cannot connect to the server.

  • 2-4 Navision Attain Architecture

    Depending on the protocol being used, there are certain steps you can take to identify the problem. (See the section "Troubleshooting the Database Connection".)

    If the connection worked, just repeat the client installation on each client computer and you are finished.

    Installing the Microsoft SQL Server Option for Navision Attain

    The setup changes quite drastically when you are using the SQL Server Option. Follow the Microsoft SQL Server guidelines when installing SQL Server on the server computer.

    In this environment, there is only one thing from the Navision Attain CD that needs to be installed on the server machine, the extended stored procedures. From the server computer, access the Navision Attain Installation CD-ROM. In the folder $:\SQL_ESP, where the $ is the CD-ROM drive, click the file xp_ndo.exe. This file contains the extended stored procedures. When prompted, enter the path to the BINN subfolder of the SQL Server installation folder. The unzipped xp_ndo.dll file must be stored in this folder on SQL Server.

    That leaves us with the clients. Once SQL Server is installed and working, you can begin installing Navision Attain on the client computers. Installing the clients has already been described in the section "The Standard Client/Server Installation". The only difference is that the name of the executable file (when creating the shortcut) is finsql.exe, and not fin.exe.

    When a Navision Attain client connects to the server for the first time, the program will prompt you to install the license on the server. Furthermore, the program adds the extended stored procedures automatically. If the program detects that the server has already been accessed by Navision Attain, it does not automatically add the extended stored procedures and you must add them manually.

    To add the extended stored procedures manually:

    Use a Microsoft tool such as Enterprise Manager to add the xp_ndo.exe file to the extended stored procedures already installed on SQL Server. The name of the extended stored procedure must be xp_ndo_enumusersids.

  • Installation 2-5

    Installing Multiple Standard Servers

    The next challenge you may face is how to install more than one standard server on the same computer. Remember that the services that run on the server machine use either TCP/IP or NetBIOS protocols. The trick to installing more than one service on the same computer is to get the two services to communicate on different levels using the same protocol.

    For NetBIOS, you simply need to use two different server names. This should allow both services to communicate with any client. On the client side, you need to change the servername parameter in the shortcut to tell it which service to connect to. You might consider creating a shortcut for every different server name.

    For the TCP/IP protocol, it is a bit more complicated. When you use this protocol, the port must be changed for the services. To change the port, you must change the services file on the server. This file is normally located in the following directory: C:\WINNT\system32\drivers\….

    If you are not familiar with changing this file, you may want to find someone more familiar with TCP/IP. Once you have changed this on the server, it will have to be changed on every client as well. Again, you can change the shortcuts on each client to specify the server name.

    Note

    Please note that there may be certain restrictions on a customer having more than one standard server running at their site. A single license file is meant to be used with one, and only one, standard server.

    Troubleshooting the Database Connection

    A database connection problem can occur when your Navision Attain standard server is running correctly, but the client installations cannot connect to it. To solve this problem, there is a different set of steps for each protocol.

    NetBIOS

    The following steps will help you determine why your Navision Attain clients cannot connect to your standard server when you are using the NetBIOS protocol:

    1 Make sure that the specific NetBIOS protocol that you are using is the

  • 2-6 Navision Attain Architecture

    default protocol on the server computer.

    2 Make sure that the specific NetBIOS protocol that you are using is the default protocol on the client computer.

    If you are still having problems connecting, contact support.

    TCP/IP

    The following steps will help you determine why your Navision Attain clients cannot connect to your standard server when you are using the TCP/IP protocol:

    1 Launch the Navision Attain client and attempt to connect to the standard server using the name of the Service (excluding “Navision Server” prefix).

    If this succeeds, the client can connect to the server and the service through TCP/IP using the name of the service. If this fails, Navision Attain is having a problem accessing TCP/IP. It could be a problem with the host’s file. You must continue to the next step.

    2 Open a command prompt and ping the IP address of the server (syntax: ping ###.###.###).

    If this succeeds, this client computer can connect to the server machine. Continue to step 3. If this fails, the problem is the TCP/IP connection to the server computer and not the Navision Attain program. You cannot continue.

    3 Go to a command prompt and ping the name of the service (excluding “Navision Server” prefix; syntax: ping servicename). Note that you are not pinging the service. You are actually pinging the server in another way.

    If this succeeds, the host’s file is set up correctly. Your setup is correct.

    If this fails, the host’s file does not contain an entry that tells TCP/IP where the service is running. Change the host’s file to include an entry that has the name of the service (excluding “Navision Server” prefix) and the correct IP address of the server. You should be finished now. However, you should test the client connection.

  • Installation 2-7

    2.2 INSTALLING THE STAND-ALONE CLIENT

    You should follow the instructions in this section as closely as possible, including which directories to use for your installation. The Navision Attain client that you are about to install is the one you will use throughout this course. The Navision Attain product CD contains the installation programs for both the client and Navision Server. When you install the client, you must also install the database containing the demonstration company.

    Client Installation

    Windows XP, 98, 2000, NT 4.0

    When you insert the CD-ROM, an HTML page should automatically open in your browser containing the following options:

    Demo – Installs the Navision Attain client demo program.

    Client – Installs the Navision Attain client program.

    Servers – Installs the Navision Attain server program.

    Tools – Installs the Navision Attain tools for C/ODBC, C/OCX and C/Front.

    Overview – Displays an overview of the entire CD-ROM.

    Home – Returns to the Main Menu.

    Click Client and then Installation of Navision Client for Windows 98, Windows NT Windows 2000. A standard Windows installation program opens and will guide you through the installation process.

    Files on the Hard Drive

    When the installation program is finished, you can explore the directory where the files were installed. Here is a list of some of the files that were installed:

    FIN.EXE Executable file for starting the Navision Attain client for Navision Server or stand-alone.

    FINSQL.EXE Executable file for starting Navision Attain client for the SQL Server Option.

  • 2-8 Navision Attain Architecture

    FIN.FLF License file that determines the functionality of the installation based on the granules purchased.

    CRONUS.FLF Sample license file renamed to the name of the demonstration company.

    DATABASE.FDB Default physical file used for the database, which contains all the objects and data.

    MASTER.CHM Main help file for the application.

    This file is store in a sub-directory along with all of the other help files.

  • Installation 2-9

    2.3 INSTALLING NAVISION SERVER

    You should practice installing Navision Server as much as possible before installing it for a customer.

    In this section, we discuss the most common server installation, Windows 2000.

    When you insert the CD-ROM, an HTML page should automatically open in your browser containing the following options:

    Demo – Installs the Navision Attain client demo program.

    Client – Installs the Navision Attain client program.

    Servers – Installs the Navision Attain server program.

    Tools – Installs the Navision Attain tools for C/ODBC, C/OCX and C/Front.

    Overview – Displays an overview of the entire CD-ROM.

    Home – Returns to the Main Menu.

    Click Servers and select Navision Server for Windows NT 4.0 (Intel) and Windows 2000. A standard Windows installation program opens and guides you through the installation process.

    Navision Server can be run as a service or as an application.

    In the Services window in Windows 2000, you can see the service that was installed:

    The advantages gained from running the server this way will be mentioned

  • 2-10 Navision Attain Architecture

    later.

    In the previous picture, Navision Server is the service that was installed by the installation program. It is automatically started during the installation and is set to automatically start every time the computer is turned on.

    As an Application

    The following is a Command Prompt window where Navision Server is started as an application. First, make sure the server is not running as a service. Go to the directory where the server files are located and type “Server”. Clients can now connect to the server just as if this were running as a service.

    D:\Program Files\Navision Server 2.60>server

    Database server for Navision Attain version 3.01 (Build 7700)

    Copyright (c) 1987-2001 Navision a/s

    Starting database server SERVER1 ...

    Cache(Kb)...........: 70144

    CommitCache.........: No

    Maximum sessions....: 2

    Maximum database(Mb): 64000

    NetType.............: tcp

    Database............:C:\\NavisionAttain\\Database Server\\database.fdb

    Licensed to.........: CRONUS International Ltd.

    John Roberts

    The Ring

    Westminster

    W2 8HG London

    World Wide 1

    0666-666-6666

  • Installation 2-11

    Using the Command Prompt has its advantages. As you can see, all the server parameters are displayed. A service does not do this. Error messages are also more descriptive when you use the Command Prompt.

    Once you are confident that everything is working here, you can be sure that the service will run without any problems.

    Advantages of Running Navision Server as a Service

    You can set Navision Server up in two ways – as a Windows service or as an application. Although, running the server as an application gives a good visual indication that the server is running and what parameters are set, the advantages of running Navision Server as a Windows service outweigh the advantages of running it as an application.

    When you run Navision Server as a Windows Service, it is set, by default, to start up automatically when the Windows 2000 server starts. Therefore, if the Windows 2000 server goes down, Navision Server will automatically restart when the Windows 2000 server restarts.

    If you set up the server as an application, someone must logon to the Windows 2000 server and start the program, and this user can never log off. If the user logs off, all programs running in that session will be terminated. Windows 2000 services are not affected. Therefore, since the user cannot log off the server console, unauthorized access to the server and its data is made easier.

    However, when you run Navision Server as a service, the program is executed in the background and is not affected by users logging on and logging off at the server console. This prevents the security of the Windows 2000 server from being compromised.

  • 2-12 Navision Attain Architecture

    2.4 PROGRAM PROPERTIES

    There are a number of program properties that apply to Navision Attain. Some of them apply to the server and others apply to the client.

    Server Program Properties

    CACHE

    Sets the amount of DBMS Cache and Commit Cache to be used by Navision.

    There is a 1-gigabyte limit.

    It is recommended that you set the DBMS Cache to 2 megabytes per user, up to about 900 megabytes, as long as at least 128 megabytes of memory are left for the operating system.

    This increases performance because it defines how much memory is available for the database.

    Reading data from memory is faster than reading from the hard drive.

    The cache area is split between DBMS Cache (read) and Commit Cache (write). Navision Attain does the allocation automatically to optimize performance.

    COMMITCACHE

    Activates Commit Cache.

    This speeds up the insertion, modification and deletion of data because the server will write to memory instead of directly to the hard disk.

    The amount allocated to Commit Cache is a minimum of 1/3, but never more than 2/3 of the total cache. When Commit Cache reaches the 2/3 full mark, Navision Attain will force write transactions to have a higher priority over read transactions.

    Furthermore, when no read transactions are waiting, committed write transactions will be written to the hard drive.

    DATABASE

    Sets the database path and file name at the time the server is started.

  • Installation 2-13

    INSTALLASSERVICE

    Installs the server as a service. •

    After you enter this command, you must use the Services window to start and stop Navision Server.

    UNINSTALLASSERVICE

    Uninstalls the server as a service.

    After you run this command, you will not be able to use the Services window to start or stop the server. You will have to run the server as an application.

    STOPTIME

    Stops the server automatically at a specified time.

    The server will stop automatically when the computer’s built-in clock reaches the specified time. You can use this function to make the database unavailable after a particular time.

    NETTYPE

    Selects the network protocol that will be used for communication between the server and the clients.

    There are two possible values:

    TCP for TCP/IP

    NETB for NetBIOS

    The same selection must be entered on all clients in the network as well as on the server.

    SERVERNAME

    Sets the server name that the clients must use to connect to the server.

    SESSIONS

    Specifies the maximum number of connections that can be made to the server simultaneously.

  • 2-14 Navision Attain Architecture

    Navision Attain allows between 1 and 500 sessions. However, the number of sessions can be limited by the protocol or the license.

    Examples

    The following line starts the server as an application with the server name of MyServer and net type of TCP. Furthermore, the server will stop automatically at midnight.

    SERVER SERVERNAME=MyServer,NETTYPE=TCP, STOPTIME=240000,

    The following line installs a new service with a server name of MyServer and net type of TCP/IP.

    SERVER SERVERNAME=MyServer,NETTYPE=TCP,INSTALLASSERVICE

    The following line uninstalls the service with a server name of MyServer.

    SERVER SERVERNAME=MyServer,UNINSTALLASSERVICE

    The following line changes the cache size and reinstalls the service with a server name of MyServer.

    SERVER SERVERNAME=MyServer,CACHE=50000,INSTALLASSERVICE

    Client Program Properties

    CACHE

    This option is the same as the server option cache. •

    If the client connects to a server, this property is ignored.

    COMMITCACHE

    This option is the same as the server option cache.

    If the client connects to a server, this property is ignored.

    COMPANY

    Specifies the company to open automatically.

    DATABASE

    Specifies the database path and the database name when Navision

  • Installation 2-15

    Attain is started.

    This option does not work when connecting to a server, because the server determines the database.

    DBREADONLY

    This option opens the database in read-only mode and does not permit changes, additions, deletions, or modifications of records.

    Applies to single user connection to the database.

    A server cannot be run as read-only.

    This property can be used for database maintenance if the database will not open normally.

    ID

    Allows the user to log in to the system using a different .ZUP file.

    The default value for this property is FIN.

    NETTYPE

    Specifies the network protocol that will be used for communicating with the server.

    There are two possible values:

    - TCP for TCP/IP

    - NETB for NetBIOS

    The same protocol must be used on the server.

    OBJECTCACHE

    Sets the amount of cache that the client computer uses to store object descriptions.

    The amount of cache you can allocate depends on how much memory is available and the number of different tasks that this client will perform regularly.

  • 2-16 Navision Attain Architecture

    It is recommended that you allocate a minimum of 1 megabyte and a maximum of 12 megabytes for this purpose. There must be at least 64 megabytes are left for the operating system. If memory is limited, the ObjectCache can be reduced to as little as 500 kilobytes, but with a decrease in performance.

    SERVERNAME

    Tells the client which server to connect with at startup. •

    NTAuthentication

    Specifies the type of authentication that is used when logging on to a server and opening a database.

    The possible value is:

    - yes

    If you are using Windows authentication will start, you can open the database that you have specified without having to enter your username and password.

    DBTEST

    Tests the consistency and integrity of the database.

    The possible values are:

    - min

    - normal

    - max

    These correspond to the database tests that can be carried out from within Navision Attain.

    TEMPPATH

    Sets the path to a folder where the temporary files are stored.

    The default value for this option is the folder where fin.exe is located.

    If fin.exe is not located on a local drive, set TEMPPATH to a folder on a local drive. This will improve performance.

  • Installation 2-17

    If multiple users share the folder that stores fin.exe, set TEMPPATH to the local drive for each user in order to avoid collisions.

    Examples

    This line starts the client and connects to the server MyServer using the protocol TCP:

    FIN SERVERNAME=MyServer,NETTYPE=TCP

    This line starts the client and changes the name of the ZUP file and places it on drive Z in the network:

    FIN ID=Z:\UserPreferences\Sally.ZUP

    This line starts the client and opens a database locally (stand-alone). It also opens the database in read-only mode:

    FIN DBREADONLY=Yes,DATABASE=C:\Databases\Database1.fdb

    Options Window

    You can change most of the properties mentioned above in the client application. For instance, you can select the database file by clicking File, Database, Open and opening a database.

    Many of the other client options can be found by clicking Tools, Options and opening the Options window:

  • 2-18 Navision Attain Architecture

    The list below details each option and its default value.

    Option Default Value

    Object Cache(KB) 8000

    The Object Cache option enables the caching of the Navision Attain program objects.

    DBMS Cache (KB) 8000

    The DBMS Cache option sets the amount of memory that will be used for data caching (Max is 1000 MB). When the DBMS cache option is set in the Client Options dialog, it only has an effect when running in a single-user mode. You must restart the program before any changes take effect.

    Commit Cache Yes

    This option enables write caching. This option is a Yes/No option and when set in the Client Options menu, it only has effect when running in a single-user mode. You must restart the program before any changes take effect.

    TempFilePath C:\TEMP\

    The TempFilePath is the directory that Navision Attain uses to write temporary files. Specifying a new path by using the TempFilePath option will change the location of the directory displayed here.

    Status Bar Yes

    This option activates/deactivates the Status Bar.

    Close Form On Esc Yes

    This option determines whether or not windows close when the ESC key is pressed.

    Marquee Full Selection

    No

    This option determines how graphical objects are selected on the screen. This setting is especially useful to users who work in the C/SIDE development environment. If you choose Yes, you must draw a rectangle that completely surrounds all the objects you want to select. If you choose No, you can select any object as long as the selection box you are drawing touches that object.

  • Installation 2-19

    Option Default Value

    Quick Find Yes

    This specifies whether or not the Find window opens automatically when you type in a text or code field that cannot be edited. If you enter Yes, the Find window will open automatically. If you enter No, you can only open the Find window manually.

    Client/Server Installation Summary

    You should now have a good idea of what installing a Navision Server and several clients entails. The basic installation is very simple. Depending on the needs of your customer, this can be much more complicated. However, you should now know enough to get started.

  • 2-20 Navision Attain Architecture

    2.5 REVIEW QUESTIONS

    Exercise 1 Installation Plan

    Your customer has 100 employees that will all use Navision Attain. These employees work in three shifts. Each employee shares a computer with two other employees from the other shifts. Only one person will be connected per computer. This customer uses TCP/IP as their network protocol. Describe the installation plan you would use to implement Navision Attain for this customer, including the equipment that the customer needs to purchase and the server property settings.

    Exercise 2 Protocol Problems

    Your customer is using TCP/IP as their network protocol. After replacing the Navision Server computer with a newer, faster machine, the clients can no longer connect to the server. What is the next step you should take to solve the problem?

    Exercise 3 Two Installations on the Same Computer

    You have convinced your customer to upgrade to the latest version of Navision Attain. They are somewhat reluctant and have asked you to install the latest version of Navision Attain on the same server as their current version. This will allow them to test out the new version of the software before the actual upgrade. Explain how to accomplish this.

  • Chapter 3.

    The Standard Database

    In this chapter, we discuss how the Navision Attain database works. Our discussion does not go into the exact details of the database. We concentrate on what is in the database, and the features that are implemented as part of the Navision Attain standard database.

    This chapter covers:

    What Is Stored in the Database

    How It Is Stored in the Database

    Setting Up The Database File

    Navision Database Features

  • 3-2 Navision Attain Architecture

    3.1 WHAT IS STORED IN THE DATABASE

    The following diagram illustrates the type of things that are stored in the database:

    Most of this is simply table data. However, the table data, is divided into several groups. Table data includes the information in each company and the information in the section of the database that is common to all companies.

    The other main items in the database are application objects. There are five types of application object: tables, forms, reports, dataports and codeunits. All the application objects that the Navision Attain client runs and uses are stored in the database.

    One other set of items that are not included in this diagram, are keys. There are many keys that the database uses to view the table data. While these are not shown in the diagram, they do take up a considerable amount of space in the database.

  • The Standard Database 3-3

    3.2 HOW IT IS STORED IN THE DATABASE

    It is important to understand a little bit about how the items in the diagram are actually stored in the database. This will give you a basic understanding of why some things are easy and others are impossible in Navision Attain.

    Objects

    Let’s start by explaining how the objects are stored. Every object in the database is stored in the Object table (Table ID 2000000001). This table does not appear in the Object Designer because you are not allowed to change it. In fact, making any modifications to this table can have catastrophic results.

    When you create a new object or modify an existing one, this table is updated. Because of the way this table is updated, development should never be done on a multi-user database. We suggest that you always develop on a stand-alone copy of the database or when other users cannot access it.

    The objects themselves are stored in binary format inside a Blob field in the record. The Object table has Object Type and ID fields. This is the table that the Object Designer actually displays.

    Company Data

    Before we begin talking about the data that is common to all companies, you need to understand the part of the database that is not shared by all the companies. Most of the data in the database is stored separately for each company. For instance, in the previous diagram, Company A contains customer table data for its customers. It cannot see the customers from Company B. Similarly, Company B contains customer table data in its own area and cannot see the customers from Company A.

    The Customer table can be changed so that it is shared, but that would require a lot of work. Since the table data is separated by company, you have to manually export all the data, delete it from the database, change the table definition and import the data back into the single shared table.

    The table description is stored in the Object table and is therefore the same for all the companies, but the data is separated.

  • 3-4 Navision Attain Architecture

    Data Common to All Companies

    Certain tables in the database store information that all the companies share. An example of this type of information is the security tables. All the companies share security for the database. You can create a table that is common to all companies as well. If you create a table like this, it will be stored in the section of the database that contains the other data common to all companies.

  • The Standard Database 3-5

    3.3 SETTING UP THE DATABASE FILE

    The standard database is stored in one logical file. The default name for the file is database.fdb. The server or client program connects to this file. The logical file can be made up of at most 16 physical files.

    Why Would I Need More Than One Physical File?

    You can actually improve the performance of the database by spreading the database file over separate hard drives. This allows the server program to request data from multiple hard drives simultaneously. The slow part of reading data from a database is the actual reading of the disk. By spreading the work over multiple hard drives, the server can save time.

    How Do I Create the Database Files?

    The first step is to create the primary database file. The first physical file is created by clicking File, Database, New. We recommend that you make all the files approximately the same size. Each file can be between 1 kilobyte (KB) and 64 gigabytes (GB).All the files together cannot exceed 64 GB, but the database can consist of just one file. Once you have decided the file size for all the files, you can finish creating this first file. Enter the size in the New Database window and click OK and the program creates the primary database file.

    Next, you need to expand the database so that it consists of more than one physical file. With the primary file open, click File, Database, Expand. In the Expand Database window, you could expand the primary database file or you can click Advanced. In the Advanced window, you can type in the path and the names for all the new files you want to create. Again, they should all be approximately the same size. Also, remember that the database will perform faster if the files are spread over separate hard drives.

    The server only needs to open the primary file, and that file will point to the others. As far as the user is concerned, this is one logical file. Once this file structure is completed, you can restore a database backup into it. The server will reallocate all of the data to take advantage of this new structure.

    Before you enter data into a database that consists of multiple files, or even restore a backup into it, be sure to close Navision Attain and restart it. You should notice a progress window which says, "Recovering list of free blocks…" This insures that the data that is entered into the database is distributed evenly among the multiple physical files, thereby ensuring efficient storage.

  • 3-6 Navision Attain Architecture

    3.4 NAVISION DATABASE FEATURES

    Because Navision Attain regards the database as one file with pre-allocated disk space, it can control all the space used by the application. This gives Navision Attain some advanced features that are not found in other competing products. These features include:

    Version Management •

    Commit/Rollback

    Optimistic Concurrency

    Built-In Backup and Restore

    Database Consistency Test

    DBMS Cache

    SumIndexField Technology

    Server Based Backup

    Version Management – The Version-Based Database

    This is a completely automatic feature in Navision Server and you do not have to do anything to implement it. However, you must understand this feature if you are to understand the way C/AL functions.

    Before we go into this, however, we need to introduce and define two terms: processes and transactions.

    Processes are never mentioned in the manual Application Designer’s Guide and are not usually thought of as a Navision Attain concept. However, there are many areas of the system that are easier to understand if you know how a process affects processing. Transactions are an important part of some processes.

    What Is a Process?

    For this purpose, a “process” is what takes place in Navision Attain from the time the user relinquishes control of a form until the form gives control back to the user. For example, when the user presses a key on the keyboard, a very brief process starts:

  • The Standard Database 3-7

    1 Navision Attain determines what key is pressed.

    2 Some translation is done.

    3 The character selected by the user is displayed on the screen.

    4 Control is returned to the user so they can press another key.

    A longer process would be when the user clicks the posting button on a journal and starts the posting procedure. The posting procedure is run and only after the procedure is completed is control returned to the journal form and the user. The duration of the process is not important. It can be as short as handling one keystroke or as long and complex as a posting routine.

    What Is a Transaction?

    A transaction describes the period of time for which at least one table is locked during a process. Whenever a table is locked, no one else can write to it or modify it. Therefore, it is very important that Navision Attain code is written to ensure that transactions are performed as quickly as possible.

    A transaction starts when the first table is locked. It can be started explicitly by using the LOCKTABLE function or implicitly by using any of the database update functions listed below. These functions automatically lock the table before performing the required function:

    RENAME •

    INSERT

    MODIFY

    MODIFYALL

    DELETE

    DELETEALL

    Once a table is locked, the transaction starts. Locking another table once the first table is locked will not start another transaction. The transaction started when the first table was locked, no matter how many other tables get locked afterwards.

    The transaction ends when the changes to the database become

  • 3-8 Navision Attain Architecture

    permanent (that is, they are committed) and cannot be rolled back. The transaction may be committed explicitly by using the function COMMIT or implicitly when the end of the process is reached. If no error has occurred prior to reaching the end of the process, all the changes are automatically committed at the end of the process.

    A transaction also ends (as does the process) if a rollback occurs and the data is returned to the state it was in prior to the beginning of the process. Rollbacks are caused by errors that can be system created or programmed. For example, the system would cause an error and therefore a rollback, if it tries to insert a customer that has the Customer No. of an existing customer. The developer can cause errors if the data does not meet certain specifications by using the functions TESTFIELD, ERROR and FIELDERROR.

    Process and Transaction Relationship

    A transaction is always part of a process, although not all processes contain a transaction (a keystroke during data entry does not lock a table). A process can contain zero, one or more transactions. The COMMIT function will be used to close a transaction before another table is locked and the second transaction starts.

    Processes and Versions

    Whenever you start a process, the current version of the database is assigned to that process. This means that from the beginning to the end of the process, all of the data that is read is consistent with the version of the data that was read at the beginning of the process.

    The advantage of this is that, for example, if a Trial Balance report is started from the General Ledger, it will use one version of the database that is completely balanced and consistent, even if other users are still making entries and posting at the same time.

    Another example is the case of a backup. Throughout the process of making a Navision Attain backup, the user creating the backup is using the same version. Therefore, when the backup finished it is completely consistent. Remembering that the data could be scattered throughout the database on multiple disk drives, you can see how important this would be.

    If another user posted a General Ledger transaction, and the debit was in the part of the database that was already backed up, while the credit was in the part of the database that was yet to be backed up, the backup would

  • The Standard Database 3-9

    not be consistent and would therefore be useless.

    How Does This Work?

    Each record is marked with the version number of the process that created it. If there are multiple versions of that record, the version that a process will use has the highest version number that is less than or equal to the current version that was assigned to this process at the beginning.

    What Happens When Another User Posts While I Am Using a Version?

    Whenever a transaction takes place, a new version of the database is created. However, the old version is still kept for as long as possible. If a session is using a particular version, those parts of the database are not discarded, even though a new version exists.

    This is why, it is so important to keep a reasonable amount of free space in your database at all times (at least 20%). This "free" space is not unused; it is available for new versions. At a bare minimum, the version that the posting process was assigned at the beginning must be maintained until the end of the process, in case of a rollback. If this much space is not available, the posting will fail Furthermore, if a user is running a long report and needs to keep a version, but another user's posting process needs the space, the posting process will get the space. The user running the report will receive an error message saying that there was not enough space. Not maintaining this amount of free space can also cause problems during long running read transactions, such as, making a backup.

    Commit/Rollback – Using Transactions

    This is almost as automatic for Navision Server as version management, but there are a few things you need to watch if you want it to work as expected.

    In order to update the Navision Attain database, a transaction must be started. This creates a new version of each table that is updated. This version, however, is not available to any other user until the transaction ends. The transaction can end in one of two ways:

    If the transaction is completed successfully, it is committed (using an implicit or explicit COMMIT statement). This sets the current version of the database to the new version created for this transaction, and the space used by the old version becomes available.

    • If the transaction fails because of an error, it is rolled back. This leaves

  • 3-10 Navision Attain Architecture

    the current version of the database and the space that was used for the new database version created by the aborted transaction becomes available.

    Transactions are started when a LOCKTABLE function is executed as part of a process. The LOCKTABLE function can be called explicitly or implicitly whenever a table is updated. From then on and throughout the rest of the process, that table uses the new version that is currently being created. Any other tables that have not been locked or updated are still using the version that was valid when the process started.

    This ensures that everything remains consistent throughout the posting process, even if somebody else changes things like posting groups while you are in the middle of posting. When a table is locked, a new version is created for that table. Every record inserted or modified gets the new version number. Nobody else can access that version, and nobody else can lock the table.

    Anyone else who starts or continues a process will use the current version or the version that was in effect when they started. Anyone else who tries to lock the table will wait until the table is available to be locked, and then lock the table and create a new version. At that point, they will see everything that everyone else did to the database since they started their process. Until that point, the only thing they could see in that table was the version that was current at the start of the process.

    For this reason, it is very important that you explicitly lock a table (using LOCKTABLE) before you look at (that is, GET or FIND) any records from that table on which future updates will depend.

    Here is an example:

    You read the last record in a Ledger table to determine the highest entry number in the table and make sure that the record you insert has an entry number that is one higher than that. Then you INSERT your record. Everything should be fine, right? After all, what can happen between two lines of code?

    Well, everything is not fine! Unknown to you or your process, when you started this, somebody else was in the middle of a 5 minute posting of the General Journal. Thus, your process was reading the most current version of the data, 4 minutes old. When you read the table, you got the highest entry number at that time (basically at the same time as the posting process started, since nobody else can create a version either).

  • The Standard Database 3-11

    Then, when you did your INSERT, an implicit LOCKTABLE was performed, and your process sits and waits for the other process to finish using the table. When the other process is completed, it makes its new updated version the current version. When you lock, you will now see this new version. In this new version, 2,000 more entries have been posted, and so the entry number you are trying to insert is no longer unused. You will get an error saying that you tried to insert a duplicate ledger entry.

    What you should have done is place an explicit LOCKTABLE before you did your read. In this situation, your process would sit and wait until the other process finished the LOCKTABLE command. Then, you would see the new updated version before you read. The read would get the highest entry number in the most updated version in the entire database – the one you are currently creating. Now, when you add one to that number and use it to insert a new record, you are guaranteed not get a duplicate ledger entry.

    Optimistic Concurrency

    What is Optimistic Concurrency?

    Optimistic concurrency means that a record is not locked before you read it for an update. Instead, the record is left unlocked while you view it, and it is only locked when you are ready to update it. If you don't update it, it is never locked. If you do update and nobody else has edited that record, everything is fine. It is only if someone else has updated the record while you were viewing it that an error occurs. That is why it is called "optimistic" concurrency. We don't lock it in the optimistic hope that we will not get into trouble by not doing so.

    With a version-based database using transaction-based updates, and automatically locking the entire table (not just one record) whenever we update a record, how can we say that we use optimistic concurrency? Well, it is true that in code you must actually do something special to implement optimistic concurrency. However, optimistic concurrency is used automatically in updates done by users using forms. These are the most common types of update.

    How Is Optimistic Concurrency Implemented?

    Situations can exist where a considerable amount of time can elapse from the moment you start to read a record until you need to update it, and you do not want the table to be locked the whole time. First, you read the record or records without placing any locks. Later, when you were ready to

  • 3-12 Navision Attain Architecture

    update, you perform an explicit LOCKTABLE, with the VersionCheck parameter set to TRUE. Now, you can update the record (reading and writing any records you wish).

    If no other process has modified these records, you can successfully complete the update. If you cannot complete the update, you will get an error telling you that somebody else has updated the record. This is the same error you would get if you were editing a record in a form and somebody else updated it before you finished editing it.

    How Does Optimistic Concurrency Work?

    As mentioned earlier whenever a record is modified, it is given the version number of the process that modified it. After you perform the LOCKTABLE with the VersionCheck parameter set to TRUE, every time a record is updated its version number is checked. If it is still less than or equal to the version number of the process, the update can go ahead without an error occurring. However, if it now has a higher version number than the process, someone else updated it since the process began and the error is generated.

    During every form update an implicit LOCKTABLE with the VersionCheck parameter set to TRUE is run before the update. We can therefore conclude that for most purposes of interest to the user, Navision Attain uses optimistic concurrency.

    For an example of Optimistic Concurrency in code, look at any of the "Post Batch" journal posting routines. Throughout the posting process, we read the journal table, so that we know what to post. However, we do not lock it, so that users can continue to make journal entries in other journal templates and batches. When we are ready to update or delete the journal entries, we run a LOCKTABLE with the VersionCheck parameter set to TRUE. As long as nobody else was editing this particular journal or batch, everything will be posted correctly. Otherwise, an error will occur and the entire posting will be rolled back.

    Built-In Backup and Restore

    Like many databases, the Navision Attain standard database has commands that allow you to create a backup file and to restore that backup file.

    As mentioned earlier, you can make a backup while other users are working with the database. However, this does have the effect of slowing

  • The Standard Database 3-13

    things down. It will take much longer to make a backup if other users are updating tables at the same time.

    When you make a backup, the file that is created is a consistent snapshot of the entire database. Only the data is backed up. If you refer back to the database contents diagram shown in section 3.1, you can see the items that are contained in the backup file – application objects, data common to all companies and the table data for each company.

    Do I Have to Make a Backup Everything?

    No, you do not have to make a backup everything. You can backup any item that you like to – just the application objects for example. Or you can backup any combination of items. You can backup Company A, Company A and the application objects, or both companies and the data common to all companies. However, you cannot backup anything smaller than these items. For example, you cannot backup only a few tables from one company. You must backup the entire company or none of it.

    Restoring a Backup

    Just as you can choose which items to backup, you can also choose which items you want to restore. However, this has some implications. Make sure you understand the following rules about restoring:

    1 The restore process is carefully designed so that no data is ever lost during a restore. You cannot restore data over existing data.

    2 If you want to restore a complete backup, you must create an empty database file (click File, Database, New) that is the appropriate size.

    3 If you want to restore only the application objects or the data common to all companies, you must restore them into an empty database file (click File, Database, New) that is the appropriate size. You cannot restore the data common to all companies into a database that already has other tables in it.

    4 If you only want to restore the company data, there are two things to keep in mind:

    Firastly, a company with the same name as the company you are restoring cannot already exist in the database. The program will not overwrite an existing company. In this case you must rename the existing company (click File, Company, Rename). Then you can restore the backup. Always document this kind of action.

  • 3-14 Navision Attain Architecture

    Secondly, the table definitions stored in the Object table must match the data that you are attempting to restore. If some of the data types of the fields are different, it will not let you import that table’s data. When the restore cannot import the data into a table, that data is imported into a copy of the original table. This new table is given a new number (usually the one billion range). Unfortunately, a customer license will not let you access this number range. You must have a developer license to access these tables.

    5 A restore should never be done while connected to a server from a client. This should be done from a stand-alone connection on the server computer. Unlike the backup, the database cannot just create a new version for the restore.

    How Do I Perform a Backup or a Restore?

    On the Tools menu, you can see the commands for making a backup of the database and restoring a backup into the database. These items are available to all users by default, unless you set up security in the database. We recommend that only certain users be allowed to make backups and restore the database. This can be a large security risk.

    A backup file can have the security tables in it, but during a restore, these tables are not looked at. When the restore finishes, whoever performed the restore is a super user in the database and can see all the data that it contains. Therefore, only trusted individuals should be allowed to perform backups. As soon as the user exits the database and reconnects, the security system takes effect again. We also recommend that you keep the backup files in a secure location (that is, limit access to those files), because anyone that has access to the client program can create a brand new database and restore the backup into it.

    Can I Use a Tape Backup With the Database?

    You can use a tape backup system or other standard backup utilities with the database files. However, you must be careful. It is very dangerous to backup a database file to tape when a user is accessing the database. This is one of the common ways in which databases are corrupted.

    Making a Backup of a Database File

    The following steps are recommended whenever you make a backup of a standard database file using a non-Navision Attain backup utility:

  • The Standard Database 3-15

    1 Stop the standard server before making the backup.

    2 Connect locally to the database using the client that is installed on the server machine and run a database test (at least a minimum test).

    3 Disconnect the client from the database file and make the backup.

    4 When the backup is finished, restart the standard server.

    This will assure that you do not corrupt the database file while it is being backed up.

    Database Consistency Test – Testing the Contents of the Database

    To safeguard against errors, you should frequently check the integrity and consistency of your database. You do this from the client installations.

    Without Opening the Program

    You can also test the database without opening the program. You start the test by setting the program property DBTest from the command line.

    Here is an example:

    FIN servername=Server1,dbtest=normal

    The possible settings for DBTest are min, max and normal. You can customize the database test if you start the test from within Navision Attain.

    From within the Program

    To start the test from within the program, click File, Database, Test.

  • 3-16 Navision Attain Architecture

    The Test Database window appears:

    You determine the extent of the test by selecting one of the four option buttons at the top of the window (such as Minimum). When you select an option, the individual tests included in that option are run.

    The following table describes what the different tests involve:

    Scope Test Fields Features Checked

    Minimum Test primary keys and data

    All records in all tables can be read. Records are sorted in ascending order according to the primary key. All fields are correct in relation to the field type.

    Test BLOBs All BLOBs (fields for pictures – for example, on the item card) can be read.

    Normal Minimum test plus:

    Test secondary keys All secondary keys in all tables can be read. Sorting is done correctly according to the secondary key.

    All fields in the sorting have the correct field type.

    Test space allocation All space in the database is either used by a sorting key or is available

  • The Standard Database 3-17

    by a sorting key or is available.

    Maximum Normal test plus:

    Test relationships The connection between the primary and secondary sorting keys is correct.

    Test field relationships

    All fields that have relationships to other fields can be accessed from the field to which they are related.

    Custom Defaults to same as Maximum

    Whatever you select.

    Primary and secondary keys, mentioned in the previous table, are sometimes described as indexes and are used, for example, when you sort information. The keys determine how information in a table is ordered. You switch keys to sort information in a table in a different way. For example, you might want to sort your customers by name or by number.

    How often you need to test the database depends on how secure the rest of the system is (including the network) and the level of security you need. It is a good idea, however, to test before you make a backup – especially if you don’t use the Navision Attain backup function.

    Note

    You cannot test space allocation when there is more than one user on the system. If you select a test that includes testing space allocation, it will not be executed if there are other users on the system, but the rest of the test will be executed normally.

    While the test is being performed, the following status window is displayed:

    If an error occurs, the program stops and displays an error message indicating what the error is and where it occurs. The following steps must

  • 3-18 Navision Attain Architecture

    then be taken:

    1 Create a Navision Attain backup of the database.

    2 Create a new database, and restore the backup into it.

    3 Run a Maximum test on the new database to check it.

    4 If it is error-free, check to make sure that the company data is correct.

    5 Afterwards, you can continue to work in the new database.

    6 If this does not work, contact support.

    Warning

    Never delete a corrupted database (one that contains an error) before a new tested database has functioned without errors for a period of time.

    It is important that you remember to make backups – and make sure that they can be restored.

    Caching – Speeding Up the Database

    There are several properties that you can set on the server or client that will help speed up the transfer of data from the database to the clients. The general term for these properties is cache. All three caches are discussed in this section.

    Cache

    The cache defines the amount of RAM the Database Management System (DBMS) will reserve and use. There is a 1-gigabyte (GB) limit for the entire cache. Caching increases performance because it defines how much memory is available for the database. Reading data from memory is faster than reading from the hard drive.

    The cache area is split between DBMS cache (read) and commit cache (write). Navision Attain handles the amount for each. The amount allocated to DBMS cache is the maximum available, but never less than 1/3 the total cache size.

    Two simple rules apply when determining the size of the cache:

    1 The more memory you assign to your cache, the more efficient the

  • The Standard Database 3-19

    cache will be. Of course, there is no reason to assign more memory to the cache than the total size of your database.

    2 The size of the cache plus the amount of memory needed by the operating system should not exceed the amount of physical memory available on your system. This may cause your operating system to swap the cache memory in and out from disk, which slows the overall speed of your Navision Attain system.

    The general rule when determining how much memory your standard server machine needs is 2 MB of RAM per session (connected user) for Navision Attain plus whatever the operating system and other programs need.

    Commit Cache

    Commit cache enhances performance and frees the keyboard faster because Navision Attain writes to memory instead of directly to the hard disk. The amount allocated to commit cache is a minimum of 1/3, but never more than 2/3 of total cache. When commit cache reaches the 2/3 full mark, Navision Attain gives write transactions a higher priority than read transactions. Also, when no read transactions are waiting, committed write transactions are written to the hard drive.

    Object Cache

    Object cache is the amount of cache used on the client computer. It stores objects on the client so they only need to be retrieved once from the Object table. The more tasks a particular client performs, the more objects that need to be run, the greater the object cache that should be allocated.

    There are several reasons why developing on a live client/server system is a bad idea. One of these reasons is the existence of the object cache. The reason for the object cache is to ensure that the client does not need to make server calls to retrieve objects that it has already read. However, if a developer were to change an object after a client had placed a copy of that object in their object cache, that client would never know it (even if that client was another developer). Thus, different people in Navision Attain would be using different versions of the same object. This could cause many problems.

    Furthermore, different developers can redesign the same object simultaneously and the developer that is finished last will overwrite the changes that were made by the developer that was finished first.

  • 3-20 Navision Attain Architecture

    The Importance of Caching

    Take advantage of caching and optimize the performance of the system. The cache is a buffer storage area that holds a copy of the portion of the database currently in use by the DBMS. If the required data is in the cache, performance is greatly enhanced because the system does not have to look for the data on the disk. The DBMS cache always holds the most recently used data. The cache automatically replaces parts of the cache memory with the relevant parts of the database. The size of the cache greatly affects performance.

    SumIndexField Technology (SIFT)

    SIFT is another database technology that gives Navision Attain its power. SIFT’s two main benefits are improved query performance and OLAP (On Line Analytical Processing), which allow you to slice and dice information within the system and to retrieve the information that you need. A secondary benefit provided by SIFT is that all the balances in Navision Attain can be calculated and do not need to be stored in the database. Therefore, master records, like those in the Customer table, do not need to be updated during a posting routine. This gives faster posting processes (another performance gain) and improves optimistic concurrency.

    SIFT is implemented using FlowFields, FlowFilters and SumIndexFields, concepts that will be covered in more detail in a later course. Here we will give you a basic understanding of these concepts.

    FlowFields

    FlowFields allow the database to calculate values based on other information stored in the database. There are several types of FlowFields.

    A FlowField can display:

    The sum or average of amount fields in another table such as the Balance field in the Customer table.

    The maximum or minimum values from a column in another table.

    A count of records from another table.

    Whether a set of records exist in another table.

    The value of another field from another table.

  • The Standard Database 3-21

    Because a FlowField is a calculated value, it does not take up any space in the table that it is defined in. The values are retrieved from the other tables when the client program requests them.

    SumIndexFields

    Unlike FlowFields, these fields are stored. You create a SumIndexField when you need to sum or average a column in a table. In the Cust. Ledger Entry table, the Amount field has been set up as a SumIndexField. At any time, the client program can request the sum of a set of records from this table on this field through code or through a FlowField.

    SumIndexFields are implemented as part of the key in the standard database. This considerably increases the amount of space the key takes in the database. Be aware of this space requirement whenever you add a SumIndexField to a key.

    FlowFilters

    FlowFilters are closely related to FlowFields. They are also virtual fields (not stored in the database). FlowFilters are placeholders for you to type in filter criteria for a certain field. The job of the FlowFilter is to transfer those filter criteria to the appropriate field in the table that the FlowField is calculating from. This allows you to change the calculation formula of a FlowField dynamically at runtime. This feature adds another layer of flexibility to SIFT.

    In the following diagram, you can see how FlowFields, SumIndexFields and FlowFilters work together to create a sum of the information that you need.

  • 3-22 Navision Attain Architecture

    Server-Based Backup

    HotCopy is the server-based backup program that comes with Navision Attain. HotCopy is installed with Navision Server and is stored in the same directory as Navision Server.

    HotCopy makes a copy of the database at the time that it is run. When HotCopy starts to copy the database, it first creates a database with the same name as the database that you are backing up in the destination directory with the extension .SAV at the end. Therefore, if your database is called Production.fdb, the name of the backup file will be Production.fdb.SAV while the information is being copied. After HotCopy has finished copying the database, the file will be renamed with the same name as the original database - Production.fdb. However, there is one exception. If the destination directory is the same as the location of the current database that you are backing up, the name of the backup file will be Production.fdb.BAK.

    HotCopy functions in a similar way as the Navision Attain client backup in that users can work in the database while the backup is running. Furthermore, because HotCopy is run from the server the backup process is much quicker than the client based backup program.

    Important

    The backup that HotCopy makes is a snapshot of the database. It does not contain information about any transactions that were carried out after the backup procedure was started. Navision Attain cannot create a transaction log. If you want to have a transaction log, you should migrate to the Microsoft SQL Server Option for Navision Attain.

    HotCopy does not have a user interface. You can however, call HotCopy in a few different ways:

    You can start HotCopy from the command prompt. •

    You can create a shortcut.

    You can create a batch file that launches HotCopy.

    Before showing examples of how to use HotCopy it is important that you understand the various parameters that can be used:

  • The Standard Database 3-23

    Parameter Explanation Optional / Required

    source The database file to be used for the backup.

    This can be either the name of the database or the name of a database file. If you want to make a backup of several database files, you must specify all of the file names.

    If you are using a backup description file, you must enter the name of the backup description file.

    You must enter either the absolute path or the relative path to the database file(s). When no path is specified the database file(s) must be stored in the same directory as HotCopy.exe.

    You can also enter the full path of the backup description file. If a backup description file is specified as the source file, all the other command line arguments are ignored. The format of the backup description file is described below.

    Required

    destination The path of the directory to which the database file is to be copied.

    If only one path is specified for the destination, but several files are specified as the source, all the files will be backed up in the same destination. If all the database files have the same name, the backups must be created in different directories.

    The database file(s) that you backup will be saved in the destination directory with the same name as the original(s). If you have previously made a backup in this directory, HotCopy will overwrite it. HotCopy will not inform you that it is

    Required if used from the command line

    Do not use if you are using the backup description file

  • 3-24 Navision Attain Architecture

    Parameter Explanation Optional / Required

    overwriting the earlier backup.

    If the destination path is the same as the source path, the database file will be saved with a new suffix ".bak". For example, database.fdb will be saved in the source directory as database.fdb.bak.

    If you have previously made a backup in this directory, HotCopy will overwrite it. HotCopy will not inform you that it is overwriting the earlier backup.

    dbtest A database test is performed before the backup is made. You can choose between three different tests that correspond to the standard Navision database tests.

    The possible values are: minimum, normal and maximum.

    If you are using the UNIX system, the maximum database test cannot test the relationship between tables.

    Optional

    cc A consistency check should be performed after the backup files are saved. The consistency check is a bit for bit comparison of the original database with the backed up one.

    The possible values are: yes and no.

    Optional

    description This is free text that describes the backup. This text is displayed as the subject in the E-mail that the administrator can receive and as the "source" entry in the Event Viewer.

    Optional

    email The E-mail address of the person who is to be informed about the final status of the backup procedure.

    Optional

  • The Standard Database 3-25

    Parameter Explanation Optional / Required

    The E-mail message contains the following information:

    Subject: This is the backup for Monday (The description of the backup).

    Backup started at 2001/03/15 10:02:50.

    Backup ended successfully at 2001/03/15 10:06:06.

    If the backup failed, the E-mail will only contain the description of the backup and a message informing you of the error that caused the backup to fail.

    If you are using the UNIX system, E-mails can only be sent if the Sendmail program has been installed.

    servername The name of the Navision Server that HotCopy should connect to when you initiate the backup procedure.

    If you omit this argument, HotCopy will try to create a connection using the "local host" name. If this also fails because Navision Server is not running, HotCopy will create a "local" connection. In other words, you can create a backup when the database server is not running.

    We recommend that you only use HotCopy when Navision Server is running.

    Optional

    osauthentication

    Tests whether or not the person creating the backup can use single sign-on (NT authentication).

    The only value you can enter is yes.

    You can either enter this parameter or the ’user’ and ’password’ parameters.

    Optional

  • 3-26 Navision Attain Architecture

    Parameter Explanation Optional / Required

    user If NT authentication is not used, this is the user ID of the person performing the backup.

    Optional

    password If NT authentication is not used, this is the password of the person performing the backup.

    Optional

    nettype The network protocol that is used for communication between the server and the clients.

    The possible values are: netb (NetBIOS) and tcp (TCP/IP)

    Optional

    You can specify a number of parameters if you call HotCopy from the command line or if you specify the settings in a backup description file.

    Using HotCopy from the Command Line

    The following example only uses the mandatory parameters.

    HotCopy source=”C:\Attain\databasename.fdb”

    destination=”C:\Backups”

    If you do not specify the full path to the database, HotCopy assumes the database is located in the same directory:

    HotCopy source=database.fdb destination=”D:\Database

    Backups\Attain”

    You can use either one of the following to backup the database to the root folder of drive C:

    HotCopy source=database.fdb destination=C:\

    or

    HotCopy source=”C:\Attain Databases\database.fdb”

    destination=\

    The example below will copy the database to the same folder as that specified by the source. The database will be named database.fdb.BAK:

  • The Standard Database 3-27

    HotCopy source=”C:\Attain Server\database.fdb”

    destination=”C:”

    or

    HotCopy source=”C:\Attain Server\database.fdb”

    destination=””

    The following example uses all the possible parameters and also shows how to backup a database that is divided into two files:

    HotCopy source=C:\database\database1.fdb

    c:\database\database2.fdb

    destination=”C:\Databases\Backups”

    ”C:\Databases\Backups” description="This is the backup

    for Monday" [email protected]

    servername=myserver user=myname password=mypassword

    cc=yes nettype=tcp

    Unfortunately the example above is not able to clearly show that all the information it contains is simply separated by spaces.

    Using HotCopy with a Backup Description File

    HotCopy source=backupdescription.txt

    The Backup Description File

    The backup description file contains the information that HotCopy will use to perform the backup. The backup description file can have any name that you like; however, it must consist of two sections:[Backup Files] and [Options] containing one or more entries. You must fill in the section called [Backup Files] where you specify the database name on the left hand side and the backup directory on the right hand side. You can only specify a directory as the destination for the backup. The backup description file can include comments - any text string that begins with a semicolon and does not take up more that one line.

    We recommend that you use the backup description file. An example is provided below:

    [Backup Files]

    ;Note: This section is required plus the value

  • 3-28 Navision Attain Architecture

    ;C:\Navision Programs\WW\Attain3_1\Database

    Server\ww31base.fdb=c:\Navision Related

    ;If you put quotes around "C:\Navision Backups" below,

    it will generate an error

    ;plus it creates an entry in the application event log:

    Event ID: 109 - Warning

    ;as does any other invalid value such as specifying a

    folder that does not exist

    ;You will also get the same message if the directory

    does not exist.

    ww31base.fdb=c:\Navision Backups

    [Options]

    ; The semi-colon is used for comments.

    ;DO NOT USE destination= in this file or you will get

    the following error message:

    ;There is not enough memory available to execute this

    function

    ;dynamic_castm_pTokenString>.

    description="Server Backup Test 1"

    ;The description is used for the subject of the e-mail

    servername=NAVISERVER

    user=SUPER

  • The Standard Database 3-29

    ;notice we do not include a password option since there

    is no password

    ;for this user since this is a test environment

    [email protected]

    cc=yes

    osauthentication=no

    nettype=tcp

    Using HotCopy on UNIX

    On a UNIX computer, the source parameter should be written as follows:

    Source=/database/database1.fdb/database/database2.fdb

    The outcome of the backup procedure is always specified in the Event Log of the computer that was used to start the backup procedure. On UNIX computers this information is stored in a file called hotcopy.log.

    Issues to Be Aware of When You Work with HotCopy

    1 HotCopy can only be run from the server location and can only create backups on a local hard drive. This means that you are not allowed to use a mapped drive and that you are not allowed to specify a UNC path to a network drive.

    However, HotCopy can be run from a client if it has read access to the database files. In this case the files must be specified with their UNC names. The client can also use mapped drives or UNC names for the destination if the user who launches HotCopy has read/write access to the destination.

    2 The backup file is not a compressed backup file. Therefore, you must ensure that you have enough disk space for the backup. If your database takes up five (5) GBs of disk space then the backup file produced by HotCopy will also take up 5 GBs of disk space.

    3 HotCopy cannot make incremental or differential backups.

  • 3-30 Navision Attain Architecture

    4 HotCopy does not have a user interface that allows you to configure the se